It seems the issue is related to an electrical problem, where when the car is on, it works normally. But when you shift the gears from park to neutral, the engine shuts off and turns off the car. This only happens at neutral.
My car has 155000 miles.
My car has an automatic transmission.
This is likely related to what is called a neutral safety switch. This is an electrical switch near your transmission that is designed to not allow the car to start when in any gear other than park. Occasionally, this switch will fail or become faulty causing it to work intermittently. When this happens it may cause the car to be shut off randomly as you describe. I would suggest having a professional from YourMechanic come to your home to diagnose and repair the neutral safety switch.