code: public void finish() {
          for (Map.Entry<String, String> entry : posTags.entrySet()) {
              posWriter.println(entry.getKey() + " " + entry.getValue());
          }
          posWriter.flush();
          posWriter.close();
  
          writer.flush();
          writer.close();
      }
docs: Finalizes the writing of documents.