Snug up all the retaining-rings you can find (driver, switch, etc.).
I’ve had lights go mental that just needed snug retaining rings, then worked fine after.
Oh yeah, clean all contact points (edge of the battery tube, etc.) with something mildly abrasive like polishing paper, scotchbrite, etc.