Since the fuel Injection for a cylinder happens during the down stroke of the piston and the ignition happens at close to the top of the next stroke, fuel is injected and compressed in the cylinder.
If you turn the key off after the fuel injection and the spark plug doesn't fire you would have unburned fuel left in the cylinder.
BMW made a change with the MS43 ECU to continue the ignition for two more cylinders after the key is turned off.
Page 16 - http://www.bmwmotorsports.org/BMW_docs/m54x5.pdf
MS 43 NEW FUNCTIONS
EMISSION OPTIMIZED - IGNITION KEY OFF
"Emission Optimized Ignition Key Off" is a programmed feature of the MS 43 control module.
After the ECM detects KL 15 being switched OFF, the ignition stays active for two more
individual coil firings. This means that just two cylinders are fired - not two revolutions.
This feature allows residual fuel injected into the cylinders, as the ignition key is switched
off, to be burned as the engine runs down.