Flush after writing full response

Fixes #179