Can't unmount external disk used with Music app due to AMPLibraryAgent process
You can try force unmounting the drive. It unmounts the drive if some process is already using it.

diskutil unmountdisk force /dev/disk2