@Override
  public void close() {
    // first waiting serialize and sync tasks finished, then release all resources
    isClosed = true;
    if (serializeThread != null) {
      // add close signal WALEntry to notify serializeThread
      try {
        walEntries.put(new WALSignalEntry(WALEntryType.CLOSE_SIGNAL));
      } catch (InterruptedException e) {
        logger.error("Fail to put CLOSE_SIGNAL to walEntries.", e);
        Thread.currentThread().interrupt();
      }
      shutdownThread(serializeThread, ThreadName.WAL_SERIALIZE);
    }
    if (syncBufferThread != null) {
      shutdownThread(syncBufferThread, ThreadName.WAL_SYNC);
    }

    if (currentWALFileWriter != null) {
      try {
        currentWALFileWriter.close();
      } catch (IOException e) {
        logger.error("Fail to close wal node-{}'s log writer.", identifier, e);
      }
    }
    checkpointManager.close();

    MmapUtil.clean(workingBuffer);
    MmapUtil.clean(idleBuffer);
    MmapUtil.clean(syncingBuffer);
    MmapUtil.clean(compressedByteBuffer);
    workingBuffer = null;
    idleBuffer = null;
    syncingBuffer = null;
    compressedByteBuffer = null;
  }
This task syncs syncingBuffer to disk. The precondition is that syncingBuffer cannot be null.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java