Stop the state machine after a few iterations