This ensures the closed viewport gets a close-event, and that it and the parent viewport gets repainting, allowing the event to be registered.
This ensures the closed viewport gets a close-event, and that it and the parent viewport gets repainting, allowing the event to be registered.