When opening script to edit, other apps open hidden

I’ve got an alarm clock script (actually a .app) that I wrote, and when I open the script in AppleScript Editor the system preferences pane opens and immediately goes hidden. I only reference the system preferences once:

	tell application "System Preferences"
		activate -- Set 'System Preferences' as the frontmost process.
		
		-- Display the 'Energy Saver' Utility of 'System Preferences'.
		set current pane to pane "com.apple.preference.energysaver"
	end tell
	top("Remember to set the wake time to " & theDate, {"Ok"}, 1, 25)

(“top” is just a subroutine I wrote to display a dialog box)

It only happens if the AppleScript Editor application isn’t open, and I usually drag my .app to the AppleScript Editor icon in the dock. Nothing else runs, the system preference pane just opens as hidden.

Any ideas why this is happening?