DispatchPendingMessages: instead of using a timeout value, use PostQuitMessage

Seems to work fine. Please test it with the cases it crashed for you without a timeout.