Occurs when the message loop of the thread should be terminated, by calling ApplicationContext.ExitThread.