code: public static File writePid(int pid) throws IOException {
      File pidFile = FileSystemUtils.newFile(PROCESS_ID_FILENAME);
  
      pidFile.deleteOnExit();
  
      PrintWriter writer = newPrintWriter(pidFile);
  
      try {
        writer.print(pid);
        writer.flush();
  
        return pidFile;
      }
      finally {
        FileSystemUtils.close(writer);
      }
    }
docs: Writes the given process ID ({@code pid}) to a {@literal .pid} {@link File}.
  
  @param pid process ID to store in the {@literal .pid} {@link File}.
  @return a {@link File} containing the given process ID ({@code pid}).
  @throws IOException if the process ID (pid) could not be stored in the {@link File}.
  @see java.io.File
  @see #readPid(File)