Applescript that uses a logout hook or runs a script at shutdown

I am trying to figure out a way to have an applescript run at shutdown.

The problem I am having is my iMac 10.5.6 takes almost 10 minutes to shutdown and I believe it is because it will not disconnect from the wireless network WPA2.

I have tried the disk utility fix, both from the 10.5 install disc and locally but that only fixes the shutdown issue for a sort while.

The iMac is connecting to a network drive, a printer, and a WPA2 wireless network. So my applescript attempt to kill the connection to all.

Here is my applescript I am wanting to have the mac run automatically at shutdown

tell application "GrowlHelperApp"
	set the allNotificationsList to {"Test Connection"}
	set the enabledNotificationsList to {"Test Connection"} -- ** just one turned on, the other not.
	register as application "login_items_v6" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "login_items_v6"
	
	--	Send Growl Notification...
	notify with name "Test Connection" title "Beginning the logout process" description "Please be patient while the computer begins to shutdown.
	
	This process could take a few minutes..." application name "login_items_v6"
end tell
tell application "Finder"
	do shell script "networksetup -setairportpower off"
end tell
tell application "Finder"
	set allVolumes to the name of every disk
	repeat with i from 1 to the count of allVolumes
		if item i of allVolumes is not the name of the startup disk then
			eject (item i of allVolumes)
		end if
	end repeat
end tell

If I run this applescript manually before shutdown, the computer will shutdown right away, if I do not the computer will take a long while to shutdown.

I am thinking of maybe setting a timer with this applescript and having this applescript run as a login item to shut down automatically at 16:00 but I am unsure as to the best approach.

Thank you in advance for all your help,
paulmattallen

Model: iMac
Browser: Safari 528.16
Operating System: Mac OS X (10.5)