docs: add nested try/finally cleanup to root TypeScript README example (#2726)

TE
2mo ago
+40-32

Summary

  • Fixes #2726
  • Updates the canonical TypeScript example in README.md to use nested try/finally blocks, ensuring stagehand.close() and browser.close() are called on both success and error.
  • Aligns root quickstart with Python and Go READMEs and prevents billable Browserbase session leaks.

Summary by cubic

Fixes #2726 by updating the root TypeScript README example to use nested try/finally blocks, so stagehand.close() and browser.close() run on both success and error. This aligns the quickstart with the Python and Go READMEs and prevents billable Browserbase session leaks.