Fixes #17 by calling DismissPopupEvent synchronous