Hi James,
Start with the easy/cheaper stuff first and re-check that the fuel level in the float chamber is not overflowing and overfuelling the engine. If you are happy that all is well with carburation and ignition it sounds like this engine is ready for a de-coke, depending on how many hours use it has had since new or last de-coke. WHY? Because I think the backfire at switch off is caused by pre-ignition ie Red hot carbon in the cylinder igniting the fuel sucked in after the ignition is killed but before the engine stops rotating! Good luck!
Mr Fixit.
Make do 'n' mend!, May 2007