'Test with the file being closed before flushing.'

def test_failing_flush(self, tmpdir):

    filename = (tmpdir / 'foo')
    with pytest.raises(ValueError, match='IO    operation    on    closed    device!'):
        with qtutils.savefile_open(str(filename), binary=True) as f:
            f.write('Hello')
            f.dev.commit()
    assert (tmpdir.listdir() == [filename])
