Is there a utility that will eject external drives?
I’ve tried force quitting the Finder (indexing was often the culprit);
shutting down all programs
and still some process is preventing the drive from ejecting.
Such a program would identify the offending process, shut it down and then eject the drive safely.