def METHOD_NAME(self, window):
    window.control.show()
    window._size = window._get_control_size()
    self.gui.process_events()
    try:
        yield
    finally:
        self.gui.process_events()
        ctxt = self.event_loop_helper.delete_widget(
            window.control, timeout=1.0
        )
        with ctxt:
            window.control.deleteLater()