This is a follow-up fix to microsoft/playwright#8385.
Testing options are limited right now, but this change was confirmed
with a client running on my physical machine and a LaunchServer running
in a Docker container.
Before this change, the har.spec.ts only passed when the client and
server were on the some filesystem.
microsoft/playwright#8450 will likely give us options to test this in an
automated way in the official CI suite.
There are a few ways for `connect()` to finish:
- `Browser.close()` from the client side.
- Browser on the server side did exit (e.g. crashed).
- Connection was dropped by either of the sides.
We reduce all the cases to the last one by dropping the
connection when client wants calls `Browser.close()` or
server-side browser exits.
In all these cases we should properly cleanup on the server side,
and ensure that all promises reject on the client side.