code: public void writeEndDocument() throws XMLStreamException {
  		try {
  			checkPendingATEvents();
  			encoder.encodeEndDocument();
  			encoder.flush();
  		} catch (Exception e) {
  			throw new XMLStreamException(e.getLocalizedMessage(), e);
  		}
  	}
docs: /*
  Closes any start tags and writes corresponding end tags.
  
  (non-Javadoc)
  
  @see javax.xml.stream.XMLStreamWriter#writeEndDocument()