If you are having data corruption woes, you can also try the old sync; sync; halt method. Shutdown is supposed to run the sync on it's own after killing the non-essential processes. But, you can evoke it at any point.
If I can get into a terminal, I typically run:
sudo sync
sudo sync
sudo shutdown -h now
I was told back in the day, the second sync was there to trigger a head park on old mechanical hard drives. But, as far as I can tell, it just makes "double sure" that the cache is flushed to disk. So far I have not had any trashed SD cards and have rebooted the rig about 2 dozen times, primarily for tuning.