  We consider topological configurations of the magnetically coupled spinning
stellar binaries (e.g., merging neutron stars or interacting star-planet
systems). We discuss conditions when the stellar spins and the orbital motion
nearly `compensate' each other, leading to very {\it slow} overall winding of
the coupled magnetic fields; slowly winding configurations allow gradual
accumulation of magnetic energy, that is eventually released in a flare when
the instability threshold is reached. We find that this slow winding can be
global and/or local. We describe the topology of the relevant space
$\mathbb{F}=T^1S^2$ as the unit tangent bundle of the two-sphere and find
conditions for slowly winding configurations in terms of magnetic moments,
spins and orbital momentum. These conditions become ambiguous near the
topological bifurcation points; in certain cases they also depend on the
relative phases of the spin and orbital motions. In the case of merging
magnetized neutron stars, if one of the stars is a millisecond pulsar, spinning
at $\sim$ 10 msec, the global resonance $\omega_1+\omega_2= 2 \Omega$
(spin-plus beat is two times the orbital period) occurs approximately a second
before the merger; the total energy of the flare can be as large as $10\%$ of
the total magnetic energy, producing bursts of luminosity $\sim 10^{44}$ erg
s$^{-1}$. Higher order local resonances may have similar powers, since the
amount of involved magnetic flux tubes may be comparable to the total connected
flux.
