Closing file handles/streams

Our debugging of GitPython during usage a while ago showed we were leaking some file handles. We think this resolves some of the issues.