Mac OS X eject disk image
Created originally on Bitbucket by daniel_fort (Daniel Fort)
Was already merged in Bitbucket before import, marked as merged by the import user
Change from "hdiutil unmount" to "hdiutil eject" for Mac OS X because eject removes the disk image completely while unmount doesn't remove the disk image from /dev, thus triggering the disk mounted error in QEMU.
From the hdiutil man page:
#!text
NOTE: unmount does NOT detach any disk image associated with the volume.
Images are attached and detached; volumes are mounted and unmounted.