Execute a certain number of program blocks and stop