Why not try out all this commands manually first, instead of in script ?
My guess of your problems here:
1. when you Shutdown abort, you may not able to startup in restrict mode. So the database startup, but in normal.
2. because the startup restrice command get an error in getting restric privilege, the connection is dropped.
3. so your third shutdown command failed because you are disconnected.
4. your shutdown command failed, so... all the processes are alive there. The database actually is either startup normal or mounted, or even nomount. Anyway it's running!
Hope you could check and let us know the result.
