Bunch of fixes for ejecting devices.

Don't crash if we get metadata updates after the device has been
closed.

If we are running metadata updates when the user ejects the device.
Wait 5 seconds to give the worker process time to cancel the
processing.

Moved the eject code that stops playback from the backend to the
frontend.  Added code that removes the audio/video tabs for the device
before we eject it.  (This ensures that we don't keep open an sqlite
database).