Prevent double end/close errors

These edits prevent a callback from being called more than once when a 'close' event is fired after 'end' or when something went wrong and a close, end or timeout happened after that error.
Added 'request timeout' error

Triggered when the request took too long to connect or process.
Prevent multiple callbacks after an error occurred

Relates to c637ff771a83dd5a100f18ef7a23c9f4ac4798f0