Enhance apple script error handling