Set the current window before calling the window closure callback.