UI: Handle page unload event to close websocket connection

Distinguishes critical rjr node errors (web requests fail upfront,
server closes socket connection) from user-initiated rjr node
events (eg on close / refresh page)

Tests need to be updated