em-http-request.rb: close connection after encountering errors