My engine can give a gasp or fart when switching on the key when there is fuel in the cylinder and ignition ignite the plug.
Maybe similar behavior when switching off.
I do not think that you will hit the valve if the cam is 180 degrees wrong. I did that mistake when timing the cam. My struggle with cam sprocket and chain moved everything that was correct when starting the fight. I saw that during the timing session. No valve-piston hits despite rather hot cam. CX-7 with 10mm lift 265' duration.
As 125-75 with 3 degree more.
I did a mistake 1984.....
Worse with 1-2 cogs wrong cam chain-sprocket. I did not check, too hurry, cam chain slack on wrong side. Cam + sprocket had marks that I could align them with without timing degree wheel... I heard the sound of valves hitting pistons. r-r-r-r-. Engine out, fixed cam timing and started OK. I saw the marks in pistons later on. Valves not bent.
I learned to always turn around the engine with cam chain tensioned, without plugs and see how the marks repeat after each revolution..