Test for handling of error on file write