AppleScript - Unmount Timeout
Hi, I'm not sure if anyone can help me with how this code of mine is arranged but I keep getting a timeout error and I'm not sure why. Firstly, my script will quit an application that's been running for a predetermined time which works fine and I allow a delay of 15 minutes to make sure that quit fully happens before moving on. I've not detailed that script as it works successfully. However, I then want to unmount the external drive that the application was using. The fist part of the script basically, closes the finder windows so the Mac doesn't come up with the "can't eject as the <external drive> is in use by finder" and then unmount but for some reason I keep getting the timeout error. I've tried putting a timout time to be longer but still the same message appears. Perhaps all it needs is a longer timeout duration or is there something wrong with my script. The scripts are as follows:
on run {input, parameters}
tell application "Finder" to close every window
tell application "Finder" to eject (every disk whose ejectable is true)
with timeout of 900 seconds
--wait 15 minutes before timeout
end timeout
end run
Perhaps, I need more to this code?
The last part of the script (again, not show) just tells finder to shut down the Mac but it never get's to that point because of the timeout.
Any ideas please. I'm not sure what else to try.
Thank you.
Mac mini 2018 or later