I have the exact same issue when triggering the command line from a scheduled task (to dismount volumes after system is idle for 60 minutes). The previously used drive letters get stuck but seem to eventually go away after some time. I assume it's a windows maintenance task figuring things out and making them available again or something, but until then no amount of doing anything else I've found from command line (fdisk etc) or GUI things (diskmgmt.msc etc) sees them other than explorer.exe or can...
I have the exact same issue. The used drive letters seem to eventually go away after some time, I assume it's a windows maintenance task doing them, but until then no amount of doing anything in command line I've found (fdisk etc) or GUI things (diskmgmt.msc etc) or killing explorer.exe completely seem to do the trick to get rid of them. The scheduled task... The last 2 mounted volumes were X:\ and then Y:\, they dismounted because you can click them and get this, but you can't re-use those drive...