Check for pending actions when closing window (delete-event)