Topology-dependent stability of vortex-antivortex structures