Save stop time to a helper. Helper state persists through automation restarts, ha restarts, and OS restarts.
Check the helper every minute. Or, just run until the stop time is reached, and create an automation to check and restart the timer when HA restarts.