Recover from failed flushes and closes too.
Merge pull request #150 from square/jwilson/recover_flush_and_close

Recover from failed flushes and closes too.