Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51324 Improve handling of exceptions when flushing the response buffer to ensure that the doFlush flag does not get stuck in the enabled state. Patch by Jeremy Norris.