JS: removed socket close in onbeforeunload. Not needed on further testing