Recover from failed flushes and closes too.