@Override
    public void close() throws IOException {
      if (myFileWriter == null) {
        return;
      }

      Writer writer = myFileWriter;
      try (writer) {
        endWritingXml();
      }
      finally {
        myFileWriter = null;
      }
    }
@Override
    public void close()