Clean up after fork more exhaustively

I was having some problems running the libgit2 test suite while
in gdb on my Mac apparently related to not handling interrupted
attempts to wait on forks.  This makes sure we really wait to
get the subprocesses cleaned up.
Merge pull request #45 from arrbee/rb/better-fork-cleanup

Clean up after fork more exhaustively
Use struct stat on Windows