Changed connect timeout to close socket *after* emitting error