This is likely to be a problem with the WS2812 bitstream output driver...
Basically what happens is:
You write a bunch of 0RGB values to /dev/ws2812
Each of these is then converted to a bit pattern for writing to the WS2812 devices through the PWM hardware using DMA.
My guess would be that something is going wrong either at the start or at the end of the sequence (the sequence must end with a final line of all zeros to turn off the LEDs otherwise they'll stay on!)
Does it happen if you increase the sleep time?