commit-tree: check return value from write_sha1_file()