code: protected void afterEndDocument() {
          if (stack[depth = 0] == WROTE_MARKUP) { // but not data
              try {
                  writeNewLine(0);
              } catch (Exception ignored) {
                  ignored.printStackTrace();
              }
          }
          stack[depth] = 0; // start fresh
      }
docs: Note that a document was ended.