@Override
  public final void close() {
    if (isPhysicallyPinned.get()) {
      try {
        unpinInternal();
      } catch (MemTablePinException e) {
        LOGGER.error(
            "failed to unpin wal {} when closing pipe wal resource, because {}",
            walEntryHandler.getMemTableId(),
            e.getMessage());
      }
      isPhysicallyPinned.set(false);
      LOGGER.info(
          "wal {} is unpinned by pipe engine when closing pipe wal resource",
          walEntryHandler.getMemTableId());
    }

    referenceCount.set(0);
  }
Unpin the wal if it is out of time to live.

@return true if the wal is unpinned physically (then it can be invalidated), false otherwise
@throws PipeRuntimeNonCriticalException if failed to unpin WAL of memtable.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResource.java