Windows won’t allow you to modify files that open programs have locked. if you try to delete a file and see a message that it’s open in another program, you’ll have to unlock the file (or close the program).
In some cases, it may not be clear which program has locked a file. Sometimes, a program or background process may have finished with a file, but not unlocked it properly when it was done. In that case, you must unlock the stubborn file or folder in order to modify the file.
Note: Unlocking certain files and deleting them can cause problems with open programs. Don’t unlock and delete files that should remain locked, including Windows system files.
Unlock a File with Process Explorer
You can unlock a file by using the excellent Process Explorer task manager. You won’t need to install it first – it’s a portable app, but you will need to run it with administrative privileges. You actually can do this from within Process Explorer by clicking the “File” menu and selecting “Show Details for All Processes.”
Next, click the “Find” menu and select “Find Handle or DLL” (Or press Ctrl+F.)
Search for the name of the locked file or folder.
Select the locked file or folder and you’ll see the handle in the details box at the bottom of the Process Explorer window. Click the Handle menu item and select “Close Handle.” If multiple processes are listed in the search window, you’ll have to repeat this step to close the handle for each process.
You can now delete or modify the file normally.