When you spawn a wither, they can fly outside of the world border and then starts shooting wither heads in a "circle", occasionally hurting it's self with them, rarely though. Wither heads can fly into the bordered area, expositions happen inside and out.
The Wither can fly outside WorldBorders but Withers have high health so it doesn't killed instantly.Resetting WorldBorder may kill the Wither but I believe that this is a bug.