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.
The callback is set the a function of CFrame, so it should be reset when CFrame is destroyed, but that only happens when the application is closed. I could add it to Shutdown(), but that wouldn't be very useful.