Applescript won't close Finder window
I'm trying to write a script to open a network server connection that will run as a user login item when mac boots up. I just want it to connect to server but, don't want to see the finder window open.
Applescript...
tell application "Finder"
open location "afp://myNASserver.../NetDrive"
return
closeFinder window "NetDrive"
end tell
It connects to the server no problem (pw saved in keychain) and opens a finder window for "NetDrive".
But, the script never closes the NetDrive window. I can hear the system beep once.
I tried putting in "delay 3" before the close action to see if that helps but, no difference.
I also tried creating a separate script to simply close the window containing only...
tell application "Finder"
closeFinder window "NetDrive"
end tell
... and, that closes the window fine. But, can't seem to get it to close the window immediately after opening the NAS when both actions are in one script. Any suggestions?
Running Mac OS X 10.9.5
Thanks.