docs: @Override public void close() throws IOException {
      sink.close();
  
      int size = stackSize;
      if (size > 1 || (size == 1 && scopes[size - 1] != NONEMPTY_DOCUMENT)) {
        throw new IOException("Incomplete document");
      }
      stackSize = 0;
    }