Add error log for failed write.