[BUG] Assigned working folder stays locked by background process after closing chat, blocking deletion (Windows)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a local folder is assigned as the working directory for a Claude Code Desktop chat/session on Windows, the folder remains locked by a background process even after the chat window is closed. Windows Explorer refuses to delete the folder, reporting that another process is still using it.
The lock is only released once the folder assignment is explicitly removed from the chat, or the associated session/task is deleted in the app.
What Should Happen?
After closing the chat window, the assigned folder should no longer be held open by a background process (or the app should clearly indicate the session is still running in the background and holding a handle on the folder). The folder should be deletable in Windows Explorer right after the window is closed.
Error Messages/Logs
Windows Explorer error when attempting to delete the folder: "The action can't be completed because the folder or a file in it is open in another program." (Windows was set to German; message paraphrased/translated.)
Steps to Reproduce
- Open the Claude Code Desktop app on Windows and start a new chat.
- Assign a local folder (e.g. a subfolder under Downloads) as the working directory for the chat.
- Let Claude Code perform file operations in that folder (e.g. sorting/moving files).
- Close the chat window WITHOUT explicitly deleting the session/task or removing the folder assignment first.
- Try to delete the folder in Windows Explorer.
Expected: the folder deletes normally.
Actual: Windows reports the folder is in use by another process. Explicitly deleting the chat/task (or removing the folder assignment) in the app releases the lock and allows deletion.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.2553.1 (Claude Code Desktop app)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Suspected cause: a background process (Node/Electron) tied to the session keeps an open file handle on the assigned working directory for as long as the session/task exists, independent of whether the chat window itself is open or closed. Only deleting the session/task (or unassigning the folder) terminates that process and releases the handle.
Environment: Windows 11 Pro, build 10.0.26200.