Follow the instructions on this page, be sure that you enable the internal <Safe Shutdown> switch.
https://github.com/crcerror/retroflag-picase
Can you try to run this on your recalbox
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/install_recalbox.sh" | bash
it must install the following files:
/opt/RetroFlag/recalbox_SafeShutdown.py
/opt/RetroFlag/recalbox_SafeShutdown.sh
/etc/init.d/S99RetroFlag check for the following line
python /opt/RetroFlag/recalbox_SafeShutdown.sh &
/boot/config check for the following lines
enable_uart=1
# Overlay setup for proper powercut, needed for Retroflag cases
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1