Currently there is no way to restart the script when there is a failure. There is an enhancement request in to supply a success or failure return code from running the script. With this you could do this but it’s not coded yet.
You can however, set a single activity to not stop on error. This is an attribute of every activity. The default is to halt the script if there is an error. But some activities might error and not be fatal.
In the example you gave, the file has to be closed in order for the process to succeed which usually would need a manual intervention.
Anyway, try the “continue on error” on activities where this is applicable.