Was at an idel at a light turned off the ac had the radio on suddenly the car dies turns back on check engine light came on. Got the code checked bad ecu or bad connection with the ecu

After the jeep warms up and is shut off and restarted there is a weird noise from the front drivers side under the hood. A metalic knock.

Car has been in the dealer for a week. Finally a bad connection was found Now a new IPM was put in but it fried when the car was started. What next?