Avoid crashing Safari during window unload

Stop the active transport before making an /abort request (JS Client)
- Desktop and mobile Safari will sometimes crash if a synchronous request
  is made during unload with an ongoing WebSocket connection open
- Stopping the ongoing WebSocket connection before making the /abort
  request during unload prevents Safari from crashing

#2650