Improve reliability of v4 debugger tests

Sometimes the test hangs on shutdown. Don't wait for the finished signal to be
emitted with an event loop, instead do the QThread equivalent of pthread_join:
wait().

Change-Id: I3583e8366c08fc0446682d124d86df4ffa3290d3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>