Fix closing of packfile
Checkout files with permissions on POSIX systems