diff --git a/src/Client.js b/src/Client.js index a6393e6..f68491f 100644 --- a/src/Client.js +++ b/src/Client.js @@ -876,7 +876,11 @@ class Client extends EventEmitter { * Closes the client */ async destroy() { - await this.pupBrowser.close(); + const browser = this.pupBrowser; + const isConnected = browser?.isConnected?.(); + if (isConnected) { + await browser.close(); + } await this.authStrategy.destroy(); }