There is an alternative way to delete the unnecessary folder. It overcomes the problem with the locked files because it ends up the process. If you are running your scripts with a batch file in OSGeo4W64 you can do the following:
1) Write this at the end of your script
with open(workspace+'Delete.py',"w") as wrfile:
This will create a new python file that will delete this specific folder.
2) In the batch file, you have both your usual file and the name of the new one that is going to delete the folder. The batch file ends up as follows: