Proposed/deps log write errors checking

Added some error checking to the deps_log writing code.
I checked manually that if I enable deps = gcc for a file depending on 10K source files it exits with the following message:
```
ninja: build stopped: Error writing to deps log: Numerical result out of range.
```
which is an improvement over https://github.com/martine/ninja/issues/605.