[PATCH 07/10] Add a delete-event handler for the main window