If it carries on running normally when you switch off, it could be the fuel solenoid on the injection pump sticking. Switch the ignition off and disconnect the connector from the injection pump (black connector), if it still runs then its the solenoid, if it stops then you have an electrical problem which is supplying an ignition feed to the solenoid when it shouldn't have one.
Mark, February 2006