The disk "..." wasnt ejected because one or more programs may be using it. MacMini M4Pro Sequoia. Check iCloud synch
My new MacMini 4M Pro w/Sequoia kept saying "The disk "..." wasn't ejected because one or more programs may be using it. Other discs ejected fine. I tried everything I found online, using terminal commands to find whatever was engaging the disc, disk utility check, the activity monitor, and even moving the disc into the privacy window of Spotlight so it wouldn't be indexed. Finally I called Apple support and spent a long time before finally realizing that when booting up in safe mode, with no background apps running, the disc ejected. When I got to an expert he wondered if iCloud was involved. The disc in question had several Photos libraries on it. I said I didn't use iCloud for photos backup. I'd already disabled every start up option (System Preferences>General>Login items>Open at Login). But we checked iCloud synch: System Preferences>Your name/Apple ID>iCloud>Apps using iCloud>Photos, and found that indeed, even though I thought I hadn't synched any Photos libraries to iCloud, "Synch this Mac" was turned on, and the library being synched was on that hard drive that would not eject.
This might be a super specific problem/issue, but if it saves you hours of work, great. Something to check.
Mac mini, macOS 15.5