The idle should be controlled by a small electric solenoid near the throttle linkage. With the key on it opens the throttle to idle speed.
There is also a idle speed screw. That would be set so the engine stalls out if the solenoid is disconnected.
That way, when you shut off the key, the throttle close completely, hopefully not pulling in gas/air mixture that causes the backfire or in some cases run on, from hot carbon spots.