Merge pull request #7 from mnicky/master

Directory to which refs should be written doesn't exist on Windows
Only mark shallow commit if it exists
Make test_fetch.lua more generic
More generic test_remotes.lua
Close files as early as possible, fix #8
Recursively resolve tags, fix #10
Close and remove pack files on exit, fix #9
Fix closing of packfile
Checkout files with permissions on POSIX systems
close more files
Merge pull request #11 from mnicky/master

Close even more files to prevent 'too many open files' error