Once the response status is sent by wire, it cannot be changed. Therefore, if you sent a 200 OK response, you cannot change your mind after that. As you have discovered, this presents a problem in the case of errors that occur in the middle of the response.
As far as I know, the only thing you can do is send a response. See Section 3.6.1 of RFC 2616:
Code coding changes the body of the message to transmit it as a series of pieces, each with its own size indicator, followed by an EXTRA trailer containing the object header fields. This allows you to transfer dynamically generated content along with the information necessary for the recipient to confirm that he received the full message.
The purpose of this trailer is to provide information about an entity that cannot be calculated before sending the entity body. However, section 7.1 allows you to include any title in this trailer:
The header extension mechanism allows additional header fields of the object to be determined without changing the protocol, but these fields cannot be assumed that the recipient can be recognized. An unrecognized field header MUST be ignored by the recipient and transparent proxies MUST be sent.
Therefore, while you can signal that an error has occurred in the middle of the response, it should be indicated between the two parts how this is signaled. You cannot, in general, use any method that you can assume that the client will understand as an error signaling.
Terminating the connection prematurely in a message with the Content-length header is an option, but it is explicitly forbidden:
When the Content-Length is indicated in the message where the message body is allowed, its field value MUST exactly match the number of OCTETs in the message body. HTTP / 1.1 user agents MUST notify the user when an incorrect length is received and detected.
However, while the server should not send a message shorter than it advertises, the client should check this error condition and report as such (and proxies may even cache this partial response).