How to turn off pwm after generate few cycle?

Hello, i want to ask how we make pwm off after generate few cycle??

so the code like this:
for(int i=0;i<=5008;i++)
{
//analogWrite(13,125);
digitalWrite(13,HIGH);
delayMicroseconds(300);
digitalWrite(13,LOW);
delayMicroseconds(300);
}

but what i want is using pwm, because when i using code like that, my motor didnt go precision..
example is pwm stop after make 5008 pulse

300uS is not very much on time for a motor. That's not even very much to turn on an LED.

What kind of motor and how is it wired up?

analogWrite(pin, 0); or analogWrite(pin, 255); effectively turn off PWM by setting the pin to 0 or 1.

...R

The analogWrite (to pin 13, which is not PWM capable) is commented out.
What the OP has is fine for 5008 300uS wide pulses. Just not very effective apparently.
5008 x (.0003 Sec x 2) = 3 seconds of activity.

If an LED/resistor was connected, it would look 1/2 bright for 3 seconds. Need to know the motor is connected - MOSFET to sink current thru a simple motor for example.