Going Back to Previous Application/Window

try adding some pauses, or try using the method gglick posted above: