code: def cleanup(self):
          
          try:
              os.remove(self.pid_file)
          except OSError as exc:
              logger.critical("Could not remove pid_file: %s", exc)
  
          # Save the final status of the flow.
          self.flow.pickle_dump()
docs: Cleanup routine: remove the pid file and save the pickle database