Scanning the script, I think it stops after wait(5) because of this line (and the one like it):
while (available_amount($item[map to safety shelter ronald prime]) < available_amount($item[E.M.U. rocket thrusters]) + available_amount($item[E.M.U. joystick]))
If the quest hasn't been started yet...