<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_menu_exit(self, event):
 """ Runs whenever Thellier GUI exits """

        if self.close_warning:
            TEXT = "Data is not saved to a file yet!\nTo properly save your data:\n1) Analysis --> Save current interpretations to a redo file.\nor\n1) File --> Save MagIC tables.\n\n Press OK to exit without saving."
            dlg1 = wx.MessageDialog(
                None, caption="Warning:", message=TEXT, style=wx.OK | wx.CANCEL | wx.ICON_EXCLAMATION)
            if self.show_dlg(dlg1) == wx.ID_OK:
                dlg1.Destroy()
                self.GUI_log.close()
                self.Destroy()
                # if a custom quit event is specified, fire it
                if self.evt_quit:
                    event = self.evt_quit(self.GetId())
                    self.GetEventHandler().ProcessEvent(event)
                if self.standalone:
                    sys.exit()
        else:
            self.GUI_log.close()
            self.Destroy()
            # if a custom quit event is specified, fire it
            if self.evt_quit:
                event = self.evt_quit(self.GetId())
                self.GetEventHandler().ProcessEvent(event)
            if self.standalone:
                sys.exit()