A bad relay could be the cause but check these things first.
Check that all connections at distributor and all wires are good condition
When it shuts off and throws a code 15, check to see that you have battery voltage at the yellow wire by using your negative battery terminal as your ground, key needs to be in ON position, if no voltage check for open wire or bad connection, if you have battery voltage there check the other connection at the distributor using the same procedure as before, you should have 10 volts there.