I had the same exception occurring. The java exception indeed indicates that something is using the folder (or contents within the folder). Stupidly, for me this was the python console within PyCharm. Within PyCharm, click on your python console and type exit()
and hit enter. Then repeat your previous steps of refactor --> rename and you should be able to rename the directory. Note that the old folder will still be present at the directory it existed with only the .idea folder and files present.
EDIT: This was working last week, but now it randomly fails. Which would seem like something else is keeping the folder or contents occupied. For now it seems that waiting 5 to 10 minutes not doing anything allows renaming. Perhaps PyCharm keeps working on the folder in the background and you wait until it is done with whatever it is doing?
PyCharm
, rename folder with your favorite file manager and reopen the project. – Wristlet