Wait for exit events before running installer. Fixes #971