As I see, this is caused by loop, which returns program to beginning.

For example, I've tried to lengthen code by repeating commands 4 times without using loop, and 4 pulses are correct.