changed the event when the dialog closes