Close jgit repository after use to clean up file handles

[FIXED JENKINS-12188]

The commit is not mine. It was created by Wannes Sels. I simply applied it to the latest version and uploaded.