code: def _unlock(self, closing=False):
          
          # write("_unlock", closing)
          try:
              if self.cur_dir != self.root_dir:
                  if closing:
                      write(
                          "Changing to ftp root folder to remove lock file: {}".format(
                              self.root_dir
                          )
                      )
                      self.cwd(self.root_dir)
                  else:
                      write_error(
                          "Could not remove lock file, because CWD != ftp root: {}".format(
                              self.cur_dir
                          )
                      )
                      return
  
              if self.lock_data is False:
                  if self.get_option("verbose", 3) >= 4:
                      write("Skip remove lock file (was not written).")
              else:
                  # direct delete, without updating metadata or checking for target access:
                  try:
                      self.ftp.delete(DirMetadata.LOCK_FILE_NAME)
                      # self.remove_file(DirMetadata.LOCK_FILE_NAME)
                  except Exception as e:
                      # I have seen '226 Closing data connection' responses here,
                      # probably when a previous command threw another error.
                      # However here, 2xx response should be Ok(?):
                      # A 226 reply code is sent by the server before closing the
                      # data connection after successfully processing the previous client command
                      if e.args[0][:3] == "226":
                          write_error("Ignoring 226 response for ftp.delete() lockfile")
                      else:
                          raise
  
              self.lock_data = None
          except Exception as e:
              write_error("Could not remove lock file: {}".format(e))
              raise
docs: Remove lock file to the target root folder.