But why does it shut off?
The crankshaft position sensor tells the engine computer where the crank is in it's rotational sequence. Since a crank rotates 2 times for every time the camshafts rotate one, it's necessary to figure out crank speed to determine when to trigger the fuel injectors and the coils. So if there's no crank signal the car will just die out.
Also next time it happens crank the engine over and see if the tachometer moves. If it doesn't then that's the problem.
Either way, just get the fault codes and I'll tell you what's wrong.
But here is my problem when driving it feels as though as if it going to shut off but if I hit the gas pedal quick enough it cut off some times.