In my case, the folder resided on a removable USB disk.
Step 1: I connected the disk to PC1 (Windows 10) and attempted to delete the folder immediately, without performing any other operations. The deletion failed, suggesting an open handle was unlikely.
Step 2: I repeated the deletion attempt on PC2 (Windows 11), again without performing any prior operations. This also failed, demonstrating that even a different Windows OS could not resolve the issue.
Step 3: Following ChatGPT's advice, I connected the disk to PC3 (Linux Ubuntu). The folder was deleted successfully.
Based on this sequence, I suspect a software bug in Windows 10 and 11 may be responsible for the deletion failure, rather than an open handle issue.
It sounds like the USB stick was formatted NTFS and there was an issue with the ACLs. Did you try resetting the owner and permissions via the folder properties Security tab?
Another possibility is that the folder had a very long path or a name with a special character (even a trailing space can be an issue). Such folders can fail to delete using Explorer but can be deleted with other tools such as the 7-Zip File Manager.
What error message was displayed when you tried to delete it?