private void closeCurrentWritingFileWriter(final boolean fsyncBeforeClose) {
    if (writingFileWriter != null) {
      try {
        if (PIPE_CONFIG.getPipeFileReceiverFsyncEnabled() && fsyncBeforeClose) {
          writingFileWriter.getFD().sync();
        }
        writingFileWriter.close();
        LOGGER.info(
            "Receiver id = {}: Current writing file writer {} was closed, length {}.",
            receiverId.get(),
            writingFile == null ? "null" : writingFile.getPath(),
            writingFile == null ? 0 : writingFile.length());
      } catch (final Exception e) {
        LOGGER.warn(
            "Receiver id = {}: Failed to close current writing file writer {}, because {}.",
            receiverId.get(),
            writingFile == null ? "null" : writingFile.getPath(),
            e.getMessage(),
            e);
      }
      writingFileWriter = null;
    } else {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(
            "Receiver id = {}: Current writing file writer is null. No need to close.",
            receiverId.get());
      }
    }
  }
{@link IoTDBFileReceiver} is the parent class of receiver on both configNode and DataNode,
handling all the logic of parallel file receiving.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java