Close jgit repository after use to clean up file handles

[FIXED JENKINS-12188]
Fix whitespace and unnecessary assignment to null