Let me check again. I'm able to run the test without killing my iTerm previously running instance (which is outside the Xcode project build directory). Are you getting your iTerm instance killed or do you need to keep other instances running that are in the same directory? Anyway, let me spend some time with AppleScript. Maybe it's easier than I think.