Corrects OSX issue: "Terminal got an error: Can’t get window 1"

It seems “set frontmost to true” was the culprit here. Adding a dummy script call fixes this issue for me in Yosemite, but should probably be tested on older versions.
Reversing some unnecessary debugging edits

Also, line 9 was previously telling the process, should have been telling the application.
Merge pull request #783 from jannae/master

Corrects the OS X “Terminal got an error: Can’t get window 1"