A script will stop execution after the last command in the file is executed. The script can be terminated at any other execution point by calling the endscript command.For example
if ftpresult ne success begin endscript;end