2008 Infiniti G35S, VQ35HR

Heres some context first: A few weeks ago my left headlight went out. Just yesterday I replaced both the HID bulbs; no difference. Today I replaced the left HID ballast and igniter, which basically took me disassembling the entire front end of my car.

Once I replaced the ballast and igniter, I turned the car on to ACC to test the headlights and both of them were working perfectly. At this point I believed I had fixed it completely. I reassemble everything and crank the car, (the car has some trouble starting.)

Once i start the car the left headlight goes out.

After driving for a few minutes the left headlight comes back on, and a few minutes after that it goes out again.

I get back home and turn off my car, to find that the left headlight turns on again. I keep turning the car on and off to test the headlights. It seems that my left headlight only turns on when the engine is not running.

Any advice for what the culprit could be? Thank you very much in advance.