Added a dirty hack to clean up stale sockets on load from the background page, as onclose does not appear to work for windows.