Make the emulation stop asynchronous to prevent deadlocks.

This PR moves the synchronisation to the last possible moment when we're already certain that the EmuThread has been shut down.

It fixes a potential deadlock where the VideoBackend is waiting for the GUI thread and vice versa. This deadlock seems to only be triggered by exclusive fullscreen, thus this PR is required for PR #506.

This PR has the potential to expose race conditions in code that does not properly check the emulation state so it should be tested thoroughly.
Can you give this function a less confusing name?