cleanup(keepLoadedFonts = false) {
    return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
  }
Cleans up resources allocated by the document on both the main and worker
threads.

NOTE: Do not, under any circumstances, call this method when rendering is
currently ongoing since that may lead to rendering errors.

@param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.
  NOTE: This will increase persistent memory usage, hence don't use this
  option unless absolutely necessary. The default value is `false`.
@returns {Promise} A promise that is resolved when clean-up has finished.