how to automatically stop the programme after completed analysis in igor pro

I'm not sure what "stop the program" means, but if you mean that you want to exit Igor, you can call the Quit operation.