This leads me to believe you are running your script via the editor, which should work. It is frustrating to have mysterious freezes and errors without much help from your Mac to track them down. I too have had scripts that simply would not run correctly within a script editor but for some strange reason would if compiled and saved as applications. So that would be my first suggestion.
The other would be to make your Mac, more specifically your script, communicate where the problem lies. If you were using a script editor other than Apple’s you could step through the script, one line at a time and isolate the problematic line of code. You could also isolate the quirk by having your script log something to a file after each action, or just the critical or suspicious steps. I had a 3000 line pig that sprouted a bug and I ended up inserting what ended up to be 300 lines of logging just to track down where it derailed. You can be as detailed as you wish, and once you track down and fix the naughty line you can remove the debugging lines.
You can define a path to a file to your activity log file at the beginning of the script. Something like:
set activityLog to "Mac HD:Desktop Folder:Activity.txt"
Then, before each line that you suspect, or if your script is small enough, before every action, insert a line of code that appends a line of text to your log. The thought is, if your script fails, or worse yet, locks up your station again you can open this log and find out what the last successful line of code was. For writing to a file I favor Tanaka’s appendtofile command (Tanaka’s OSAX v1) . It is quick and easy and would look something like:
appendtofile "Line 174 About to get RA status" & return to activityLog
If you don’t want to download Tanaka’s fine scripting addition you can achieve the same effect through Standard Additions.
set activityEOF to get eof activityLog--first get the end of the file (where we'll start writing)
write return & "Line 174 About to get RA status " to activityLog starting at activityEOF--then write the line, starting at EOF, and be sure to include a carraige return
I wish I could throw you a quick fix but without knowing where your script is failing, or being there to see it in action makes it tough. This should get you on your way to isolating the problem though.
Best of luck!