check readyState in sendPacket and close on upgradeError too