JIRA: https://jira.spring.io/browse/INT-4237 It was possible to flush (close) the file while a write was in process; more likely when `flushWhenIdle` is false. This probably would not occur in the real world, just tests with short flush intervals, but certainly possible. There is already a lock used to prevent concurrent writes while appending; use the same lock when flushing.