This patch:
- co-locates beforeunload tests
- adds new tests to make sure browser and browsercontext can be closed if there's
a page with beforeunload listener
- re-writes the `should access page after beforeunload` test to properly
emit `beforeunload` event
References #4021