Apple Script for Shut Down Routine

After my recent experience with my backup routine not being as solid as I thought it was - hadn’t been using Time Machine properly so had incomplete backups - it occurs to me that someone who knew how to write apple script might be able to write a script for a shut down routine which closes Scriv and automatically runs a TM back up. Would that work? In theory?