public boolean isFinalized() {
        return (tags.isEmpty() && cachedTag == null);
    }
Check if all tags have been properly closed.

@return true if all tags are closed
document/src/main/java/com/yahoo/document/serialization/XmlStream.java