Applescript App delays quitting when launched using applescript

I am having a problem with an applescript app that I was able to hack up and piece together. A quick explanation of what the app does is, it allows me to play a custom system alert sound when the app runs and then changes the system alert sound back to the default when it quits. Although I have changed the attached script slightly so that it should work for anyone running OS X as it is written below, the custom sound that I have it play is an empty .aiff file which instead of hearing an audible sound the screen flashes. Because I purposely want the screen flashing effect I can’t use an external player like Play Sound since it does not understand the empty .aiff file. When I double click the app icon it launches, plays the alert sound (flashes the screen) and then quits right away. However, I am trying to use this with home automation software so that the app launches and flashes my screen when the door to my store is opened that way if I am back in the office at my computer I know when a customer comes in but when I am up front with customers and other people come in I don’t hear constant beeping. Now to the problem… My home automation software (Indigo) allows me to trigger an applescript but not directly open another app. I have tried to write a script that launches and runs the app which it does however, unlike when I directly double click the app it does not quit right after flashing the screen, it stays open for and extra 20-25 seconds. Any ideas as to why the app delays quitting when launched with an applescript and more importantly any ideas as to how I can make the app quit directly after running like it does when it is double clicked? I have tried putting a tell application quit section into the the script that launches the app but that does nothing. It still delays quitting.

Here is the applescript for the app. It is saved from the script editor as an application called “Flash Screen” with the stay open option selected. Also remember that since it is an application you have to double click the icon to actually run it. Although it was written with applescript and you can open it in the script editor, running it from within the editor will not produce any results.

property mySound : "/Users/admin/Library/Sounds/flash.aiff" -- name of a system alert sound
global currentSound, myMACaddress

--figure out where the beep sound is located inside the Application Bundle (package)
on run
	-- get current system alert sound
	set myMACaddress to words 2 thru 7 of (do shell script "ifconfig en0 ether | grep -i ether" as string) as string
	set currentSound to do shell script "defaults read ~/Library/Preferences/ByHost/.GlobalPreferences." & myMACaddress & ""
	set av to alert volume of (get volume settings)
	set volume alert volume 0
	set_system_sound() -- set new sound
	set volume alert volume av
end run

on idle
	beep 6
	tell me to quit
end idle

on quit
	set av to alert volume of (get volume settings)
	set volume alert volume 0
	do shell script "defaults write ~/Library/Preferences/ByHost/.GlobalPreferences." & myMACaddress & " " & currentSound
	set volume alert volume av
	continue quit
end quit

on set_system_sound()
	do shell script "defaults write ~/Library/Preferences/ByHost/.GlobalPreferences." & myMACaddress & " " & mySound
end set_system_sound

Here is the very simple script that I am using to run the app.

launch application "Flash Screen"
run application "Flash Screen"

For anyone interested, I found a workaround using the Unix kill command as referenced in this thread.