code: @Override
      public void close() throws IOException {
          if (dataFile != null) {
              //TODO create separate method for this
              if (!append) {
                  dataFile.seek(0);
                  try (RandomAccessFile rf = new RandomAccessFile(file, "rw")) {
                      rf.getChannel().transferFrom(dataFile.getChannel(), 0, dataFile.length());
                  }
              }
              try {
                  dataFile.close();
                  dataFile = null;
              } catch (Throwable th) {
                  //no-op
              }
          }
      }
docs: Will close all opened resources and "finalize" the write process