async destroy() {
    this.destroyed = true;

    try {
      if (this._worker?.port) {
        this._worker._pendingDestroy = true;
      }
      await this._transport?.destroy();
    } catch (ex) {
      if (this._worker?.port) {
        delete this._worker._pendingDestroy;
      }
      throw ex;
    }
    this._transport = null;

    this._worker?.destroy();
    this._worker = null;
  }
Abort all network requests and destroy the worker.
@returns {Promise<void>} A promise that is resolved when destruction is
  completed.