added commandline option to quit after X cycles

Because someone seems to be unable to cherry-pick from incoming pull requests