Mine often runs out of Pokeballs because it will throw many of them at a Pokemon whose CP is too high, so it often takes 8-10 balls before the Pokemon is caught or flees. You can adjust the CP Pokeball strategy, but it's not perfect because different Pokemon are catchable at different CPs with different balls. For example, I can catch an 800+ CP Slowpoke or Krabby with a regular ball, but I can't catch a 300 CP Charmander with one. The program really needs an "escalation" strategy where it switches to a Greatball or Ultraball after so many regular balls are thrown.
If it just stops immediately, close the program, delete your statistic.js file from your cache folder, then restart.