Added res.headersSent if test to res in request.on.socket timeout callba...

...ck method and req.on error event callback method to prevent error.