#4: check for write errors and log them