Add extension installation, app installation and app launch code

update error handling code to work if we cannot launch/close app automatically