Fix bug where XY registration does not close when it should