Stop File in Use Error on a Closed File
In this article
This guide helps you resolve the frustrating “file in use” error that appears even when the file appears closed. This usually happens because a background process, a hidden preview pane, or an unclosed handle keeps the file locked. Follow these steps to identify and release the lock so you can move, rename, or delete the file.
What You'll Need
- Administrator access to your computer (to end background processes if needed)
- The exact file path of the locked file (you can copy it from the error message or by right-clicking the file and selecting “Copy as path”)
- Optional: A free tool like Process Explorer or LockHunter (download from the official vendor site)
Step-by-Step
- Close all visible programs that might use the file. Check open windows, especially office apps, media players, and image viewers. Even if the file isn't on screen, a program might have it open in the background.
- Check the File Explorer preview pane. Open File Explorer, go to the “View” tab, and click “Preview pane” to turn it off. The preview pane can lock a file just by displaying it. Also turn off the “Details pane” if it's on.
- Use Windows built-in tool to find the locking process. Press Ctrl+Shift+Esc to open Task Manager. Click “More details” at the bottom if needed. Look for any suspicious processes that might have the file open – for example, a document editor, a media server, or a backup utility. If you see one, right-click it and choose “End task.”
- Restart Windows Explorer. In Task Manager, find “Windows Explorer” under “Processes.” Right-click it and select “Restart.” This refreshes the file system and often releases stale locks.
- Use a dedicated lock finder tool. Download and run Process Explorer (from Microsoft Sysinternals) or LockHunter. In Process Explorer, press Ctrl+F to open the “Find Handle or DLL” dialog, type the file name (or part of it), and click “Search.” The tool will list processes that have the file open. Right-click the process and choose “Close Handle” (if you're sure it's safe) or “Kill Process” (as a last resort).
- Check for scheduled tasks or startup programs. Open Task Scheduler (search for it in the Start menu) and look for any tasks that might run on a schedule and access the file. Also check startup apps in Task Manager > “Startup” and disable any that might lock the file.
- Try renaming the file instead of deleting. Sometimes you can rename a locked file even if you can't delete it. If renaming works, you can then delete the renamed file.
- Reboot the computer. A reboot clears all locks. After restarting, try to delete or move the file immediately before opening any other program.
Common Mistakes
- Assuming the file is closed just because you closed the window. Many programs keep file handles open in the background (e.g., Word might keep a lock on a document you closed but have in “Recent files”).
- Using “Unlocker” tools that are outdated or bundled with adware. Stick to well-known tools like Process Explorer or LockHunter.
- Killing every process that shows up in Process Explorer. Some processes are system-critical (like svchost.exe). Only close handles you are sure belong to the file.
- Forgetting to check network shares. If the file is on a network drive, another user might have it open. Ask them to close it.
Tips
- Use the “Restart” option in File Explorer instead of manually ending the process – it's safer and faster.
- When using Process Explorer, search for the full file name (e.g., “report.docx”) to avoid missing partial matches.
- If the file is on a network drive, try copying it to your local drive first, then delete the original.
- For files in the “Temp” folder, they are often locked by the program that created them. Close all programs that might use temporary files (like browsers or installers).
- Keep your antivirus in mind. Some antivirus software locks files while scanning. Temporarily pause real-time protection (if you trust the file) and try again.
Troubleshooting
If the error persists after trying all the above:
- Check if the file is read-only. Right-click the file, select “Properties,” and uncheck “Read-only” if it's checked. A read-only file can still be locked by a process.
- Look for hidden processes. In Task Manager, click “Details” tab and sort by name. Look for anything unusual like “winword.exe” or “explorer.exe” that might have a stuck handle.
- Run a disk check. Open Command Prompt as administrator and type
chkdsk /f(you may need to restart). This can fix file system errors that cause locks. - If the file is on a removable drive, safely eject it and reconnect. Sometimes the drive's file system gets confused.
- Consider using the “Take Ownership” option. Right-click the file, go to Properties > Security > Advanced, and change the owner to your user account. This can help if permission issues are causing the lock.
Frequently Asked Questions
Why does Windows say the file is in use when I haven't opened it?
Windows may consider a file “in use” if any process has a handle to it, even if you didn't open it manually. This can happen with background services, antivirus scans, or File Explorer's preview pane.
Can I force delete a file that is in use?
Yes, but it's risky. You can use a tool like Process Explorer to close the handle, or use the command line with del /f after ending the process. However, force-deleting a file that a program is writing to may corrupt data.
What is the difference between “Close Handle” and “Kill Process” in Process Explorer?
“Close Handle” releases the specific lock on the file without stopping the program. “Kill Process” terminates the entire program, which is more aggressive and may cause data loss in that program.
Why does the file lock come back after I close the handle?
If the program re-opens the file automatically (e.g., an autosave feature), the lock will reappear. You may need to disable autosave or close the program entirely.
Is it safe to use third-party unlocker tools?
Most reputable tools are safe, but be cautious of downloads from adware sites. Stick to official sources like Microsoft Sysinternals for Process Explorer.
What if the file is locked by a system process?
If a system process like “System” or “svchost.exe” has the file locked, do not kill it. Instead, reboot the computer. If the problem persists, the file may be corrupted or part of the operating system – do not delete it.