[#2209] Allow to cancel non-flushed writes

Proposed fix for #2209