cleared all pre-existing event handlers on old sockets.
Putting in a hacky fix for this onclose thing
forgot to build; here are the files
Merging in nicks fix on close branch.