[COOK-3302] Fix hdiutil detach failure due to cfprefsd

- Try to set __CFPREFERENCES_AVOID_DAEMON=1 if on Mountain Lion or
  greater to avoid cfprefsd launch (doesn't seem to obey all the time)
- Force unmount dmg if detach fails the first time