use user.Error instead of directly closing the socket