better output handler response header check

The output handler was maintaining its own guard to prevent writing headers when they are already sent. This is not an efficient solution as the headers can potentially have been written by virtually anyone that has access to the response. This was causing our app to crash and stop when we had two errors.