fix deletion of .git/objects sub-directories in git-prune/repack
Both git-prune and git-repack (and thus, git-gc) try to rmdir while
holding a DIR* handle on the directory. This can leave dangling
empty directories in the .git/objects on platforms where directory
cannot be removed while they are open.
First call closedir() and then rmdir(); that is more logical ordering.
Reported-by: John Chen <redacted>
Reported-by: Stefan Naewe <redacted>
Signed-off-by: Karsten Blees <redacted>
Improved-and-Acked-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>