How the tableau will know that your employee going to exit.
Better try with batch script and add employee last date of working with task scheduler to deactivate.
If you are using a perpetual licence, you can use the RECLAIMLICENSE installer option here: Deploy Tableau Desktop
It will return any keys on the machine. I haven't seen a similar method for term/subscription licenses.