Second method: Secondly, if you know that to which program the files belong to, close the program using Task Manager. Some programs may run in the background linked to the files. To open Task manager:
>right click on the task bar and click on task manager
>under the process tab there will be a list of programs currently running in the system. Select your program and click on End task. Now with the program closed. Now you will be able to delete the program.
If you have no idea about the program that hold your files proceed to the next.
Third Method:If the error still persists, try rebooting the system. Rebooting solves most of the problems caused by programs. After rebooting, try to delete the folder.
Fourth method: This problem also occurs when there is a virus or malware program involved with the files. So a simple rebooting may not help you. Try Rebooting your system in Safe Mod.