motiondetector: fix destructor: thread was stuck waiting for a notification.

Destructor now sends a dummy notification to unlock and stop the detection thread.
MotionThread object uses a reference to a Capture object, thus, it must
be terminated BEFORE the Capture object.