This also adds a header with a signature, version info, and the number of objects to the pack file. It also encodes the file length and type more efficiently.