Welcome, and thanks for using Just Answer. I am Cam, and I will do my best to assist you. When you are finished please click on accept only if you are satisfied. I don't get paid unless you do.Please do not accept if you cannot leave positive feedback. I don't know if you are a tech or a just working on your own vehicle so we may have to fine tune the answer. I only know as much about your problem as you have told me in your post, so my answers will be based on what you tell me so please add all the details you can. About your vehicle,
The engine dying like the key is shut off is usually a bad injection pump. These are notorious for this issue. When it will not start, see if you can unplug the optical fuel temp sensor on the top of the pump. If it will start after that is unplugged then it is a bad injection pump.
Troy, yes it could be, and most try that first with a cooler device called an FSD cooler. install is about 20 mins.