gltfpack: Refactor file operations
gltfpack: Refactor file operations

Introduce writeFile and clen up error handling in both readFile and
writeFile.

zeux/meshoptimizer,zeux/meshoptimizer,zeux/meshoptimizer