Flush after writing full response

Fixes #179
Merge pull request #183 from rgrinberg/fix-179

Flush after writing full response