I just tested this with Voice Memo and can confirm it works at least in that scenario. The recording didn't stop, the mic was just disconnected then reconnected when lid was opened. Using Amphetamine w/ script installed on M1.
Just to point it out, but there’s a native terminal command `caffeinate` that does the same as Amphetamine.
I use the -disu flags