code: def cleanup(self):
          
          size = settings.get('history_size')
          self._save_history_to_file(self.commandprompthistory,
                                     self._cmd_hist_file, size=size)
          self._save_history_to_file(self.senderhistory, self._sender_hist_file,
                                     size=size)
          self._save_history_to_file(self.recipienthistory,
                                     self._recipients_hist_file, size=size)
docs: Do the final clean up before shutting down.