Build log write error checking.

Like f6f00aa40f0c541df06, but for the build log instead of the deps log.