send a response if the cgi script failed

Currently, if a CGI script exits before generating any output, the HTTP response hangs. This PR fixes that by inspecting `res.headersSent` at the end of the request, and if they have not been sent, sends a generic 500 status response. 

There might well be a better way to handle this, but not without going more into the depths of `stream-stack` than I have time for right now.