You could have a valve body that is acting up. When the car shuts down, the engine shakes quite a bit. This could make it work on and off again.
Also, the torque converter could be acting up.
ASE CERTIFIED MASTER AUTO TECHNICIAN
MERCEDES SPECIALIST 11 YRS