code: def postloop(self):
          
          try:
              if readline:
                  readline.write_history_file(sys.argv[0] + ".history")
          except Exception, err:
              if not isinstance(err, IOError):
                  self.stdout.write("history error: %s\n" % err)
  
          # clean up command completion
          cmd.Cmd.postloop(self)
  
          if self.interactive:
              self.stdout.write("Exiting...\n")
  
          # tell the core we have stopped
          core.deferred(core.stop)
docs: Take care of any unfinished business.
          Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.