Can I make my program restart automatically when terminated?

Yes, to do this, set the Upon program exit option on the Advanced tab to Restart the program.