Add a way to check if the application is exiting.

This is designed to prevent deadlocks and not attempt operations relying on an eventloop running
Increase API following change to MythCoreContext
Prevent deadlock in mythbackend when exiting

This is certainly not a proper fix; sockets should be deleted in the thread they are created.
Deletion here rely on qEventLoop to be running, which doesn’t exist at this point in the runtime, so we wait forever for the invokeMethod to exit.
Prevent deadlock in mythbackend when exiting

This is just a dirty workaround; there should be a better way to do things

Fixes #11783