Fixing exit event so the dialog can be centred on main UI window