force socket disconnect on window close