code: public void closeFile() throws JournalException {
          if (journalFile == null) {
              throw logAndGetException("Attempting to close a file "
                      + "when no file is open.");
          }
  
          try {
              writer.close();
              journalFile.close();
          } catch (IOException e) {
              throw logAndGetException("Problem closing the file '"
                      + journalFile.getName() + "'", e);
          }
  
          logger.debug("closing file: '" + journalFile.getName() + "'");
          journalFile = null;
      }
docs: Request to close a file. Check that:
  <ul>
  <li>a file is open,</li>
  <li>we are able to close the file.</li>
  </ul>