diff --git a/agent/main/lib/Agent.ts b/agent/main/lib/Agent.ts index 8dc6bccac..c92182b12 100644 --- a/agent/main/lib/Agent.ts +++ b/agent/main/lib/Agent.ts @@ -141,6 +141,7 @@ export default class Agent extends TypedEventEmitter<{ close: void }> { return await this.createBrowserContext(browser); } catch (err) { + await this.close(); this.isOpen.reject(err); } finally { this.isOpen.resolve(this.browserContext);