Why does my diesel engine run on for a few seconds after switch off?

Currently driving a peugeot 306 d turbo, 150000 miles, no matter if engine is hot or cold when i turn engine off its keeps running for literally 2 seconds? Also when tubo comes in it puffs black/blue smoke like a chimney. Is it ready for the scrap yard?
7 answers 7