Closes open elements and attributes and sets the XmlWriter.WriteState back to the WriteState.Start state.
TypeReasonArgumentExceptionThe current instance is in the wrong System.Xml.WriteState, or the document does not have a root element.