We analyze the role of the surface terms in the conservation law for the sum of the magnetic helicity density and the chiral imbalance of the charged particle densities. These terms are neglected in the chiral magnetohydrodynamics (MHD), where infinite volume is considered typically. We discuss a finite volume system, such as a magnetized neutron star (NS), and study the contribution of the surface terms to the evolution of the magnetic helicity. Accounting for the fast washing out of the chiral imbalance in a nascent NS, we demonstrate that the surface terms contribution can potentially lead to the reconnection of magnetic field lines and subsequent gamma or X-ray bursts observed from magnetars. We derive the additional surface terms originated by the mean spin flux through a volume boundary arising due to macroscopic spin effects in electron-positron plasma. Then, comparing this quantum surface term with the classical one known in standard MHD, we find that the new quantum contribution prevails over classical term for the rigid NS rotation only. Reference: M. Dvornikov and V. B. Semikoz, JCAP 08 (2018) 021; arXiv:1805.04910.