Fix exitEventLoop when called during idle handling.