Create pack-write.c for common pack writing code