There are many reasons for the engine run on after the key is removed especially the later model diesel with all the smog devices - a minor vacuum anywhere can cause it.
Here are some of the areas that I can think of now:
(1) bad vacuum shutoff box.
(2) bad key switch.
(3) loose or open rubber connectors
(4) defective smog devices.
(5) defective vacuum valve.
(6) defective or weak engine vacuum pump.
If it is (1), (2), or (6), it will be easy to tell with proper test tools.