Fix issues with application profile triggers when creating a virtual buffer fails.
If creating a virtual buffer failed in api.setFocusObject, the global focus variables weren't set, but application triggers were already exited/entered. This meant that next time the focus changed, NVDA tried to exit triggers that had already been exited. Also, there may have been triggers entered that were never exited.
Exceptions from treeInterceptorHandler.update are now caught. Also, the call to handleAppSwitch has been moved as late as possible so other exceptions don't cause this problem. Ideally, there aren't any other possible exceptions like this, but it's best to be safe.
Fixes #3804.