private void closeStartIfNecessary() throws IOException {
  if (closeStart) {
    writer.write(">");
    closeStart=false;
  }
}

private void closeStartIfNecessary ( ) throws IOException { if ( closeStart ) { writer . write ( ">" ) ; closeStart = false ; } }
this method automatically closes a previous element ( if not already closed ) .
