This was an issue I experienced a lot more often in Windows XP. I thought I would be rid of now, but I was wrong. It appears some applications, specifically ones related to services, in our case Symantec Endpoint Protection, fails to properly release handles to the registry keys. Obviously nothing new. And no, I do not use BitLocker in this instance and I am pretty sure we have not enabled tamper protection (it is not a BIOS default and we are lazy like that). It appears UPHClean might not be supported on Windows 7 at all. Is there some other way to force registry handles to get shut off?
Procexp can close handles. Use Find->Find Handle or DLL to find the one you want, click it (it will appear in a list in the bottom pane) and right click->close.
Warning: I do not recommend doing this!
But since you asked...
That was written in Powershell 3, but it will also work in Powershell 2, which comes baked into Windows 7 out of the box.
But please don't just copy paste my script and run it. Think about the havoc it will wreak on your system if you go willy-nilly trying to close every registry handle on the system. For instance, my first recommendation would be to scope this to only the process that is erroneously holding handles open.
Personally, I highly suspect that there is a better way of solving whatever problem you have than forcefully closing handles. And the hostile attitude that you displayed toward Windows in the comments of @MattLyons answer leads me to believe that you may be out of your element and might be misunderstanding the problem. It may be more helpful to let us know the actual problem you're having. Forcefully closing handles might not be the best way to solve it.
But I can't resist the temptation of scripting something. It's like a disease.