async _closeStream(timeout = this.timeout) {
    await this.#runHooks("close");

    const fragment = this.footer(this.footerElement());

    await this.write(fragment);
    this._status("closing");
    return promise(this.parser, "end", "error", timeout);
    // The 'close' status is set by the parser 'end' listener
  }
Closes the stream and wait for the server to close it
https://xmpp.org/rfcs/rfc6120.html#streams-close
https://tools.ietf.org/html/rfc7395#section-3.6