close websocket if proxyReq is closed before upgrade

avoids leaving client sockets open when upstream connections are rejected before the upgrade event fires.

I'm not 100% sure about the style or logic of the patch, but the added test cases and my own code suggest that it is doing the right thing. Guidance would be appreciated.

closes #624
closes #627