Some batteries have internal protection circuitry that will try to shut off the load if the battery voltage, or current draw is too high. If your batteries are flat, the voltage may start high enough to power the laser, but after being on for a while, the voltage may dip too low, trigger the protection circuitry, and shut off the laser. When a load is disconnected from a battery, it's voltage will float up a bit higher, so it sometimes can get stuck in a loop like you're describing.