Every now and then a file becomes locked by Windows so that I can't rename or delete it. I thought the file might be still in use by some program but it didn't seem to be the case.

Now it's just happened with a folder. I've checked the attributes and it was read-only so I've unchecked that option. But if I right click on the folder again, it turns out it's still read-only!