Never tried it, but I'm pretty sure if you have comfort access, then you turn off the engine by pressing the button once, but you don't get out and lock the door, all the electrical stuff stays on including the lights and the radio etc.
Maybe OP turned off engine, and got out without pressing the lock button to completely shut down the car. Not sure if the car would override and turn off on its own.
E92 M3 | Jet Black | All OEM Everything
E30 M3 | Alpine White | Mostly OEM