I had the same problem when I installed my older HID H7 kit. Mine has a wiring harness that had a relay and was powered off the battery but also had 2 leads to the headlight socket. When I removed the harness to the battery and powered the ballast off the bike's harness, it would do exactly what you describe. So, I went back to wiring it off the battery with a relay and it's been good for the last couple of years. Mine is first gen (??) HID that I've had on a previous bike and is about 5 years old. I'll be replacing it soon with a new gen utlra slim ballast HID kit.