fixed socket destroying if connected is -1 (the connection is closed by server during authorization phase)