In my case (Win8.1, TortoiseGit running), it was the process called "TortoiseSVN status cache" that was locking the file.
Killing it allowed me to run "git gc" without any more problems.
The above process is fired up by TortoiseGit, so there is no need to manually restart it.