@Override
  public void close() {
    if (nextMatchedNode != null && !shouldVisitSubtree) {
      // release nextMatchedNode
      releaseNode(nextMatchedNode);
    }
    while (!visitorStack.isEmpty()) {
      popStack();
    }
  }
This method must be invoked before iteration
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/tree/AbstractTreeVisitor.java