Windows Task Manager may prevent safe removal of USB drive

I recently experienced problems removing a USB drive safely from a Thinkpad T440p running Windows 10.

I saw this warning:

Windows_is_unable_to_stop_the_device

Windows is unable to stop the device 'USB Mass Storage Device'. Don’t remove this device while it is still in use. Close any programs using this device and then remove it.

 

I checked if I was deliberately using any files or folders on the drive, but that was not the case.

 

I checked which processes held handles on the D: drive using the useful utility handle.

C:\bin\Handle>handle d:\

Handle v4.0
Copyright (C) 1997-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

System             pid: 4      type: File           FA0: D:\$Extend\$RmMetadata\$TxfLog\$TxfLog.blf
System             pid: 4      type: File          1788: D:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000002
System             pid: 4      type: File          193C: D:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000001
System             pid: 4      type: File          1B60: D:\$Extend\$RmMetadata\$Txf

 

I found this in Event Viewer:

Log Name:      System
Source:        Microsoft-Windows-Kernel-PnP
Event ID:      225
Task Category: (223)
Level:         Warning
User:          SYSTEM
Description:
The application \Device\HarddiskVolume4\Windows\System32\Taskmgr.exe with process id 7432 stopped the removal or ejection for the device USB\VID_1058&PID_1023\57584C3145313145534A5A36.

 

The problem was solved by closing task manager. Then the USB drive could be removed safely.