Alerts are autodismissed now - in my case alert had 'OK' button disabled so default behavior from the instruments was to click on it endlessly.
If script detects that we went outside of the app - execution is stopped. This does not work 100% of the time but helps to prevent a lot of cases when script gets stuck (in my case it was clicking on a link which opened Safari)
Some improvements for #16 :