fixed case when socket closes during upgrade handshake