shutdown gracefully to create a window for event to be delivered. fixes #3897