I want my provider to "log out" of the API when it's finished

In my provider’s Configure() method it fetches an API session token which is made available to resources and data sources via their Configure() methods.

So far so good.

For $API_REASONS, I’d like to kill off the session token (log out) when terraform finishes.

Recovering the session token after providerserver.Serve() exits is a solved problem, but I’m not sure what to do with any error which may crop up during a logout attempt at this late stage in func main().

Is there a way to surface user-facing errors after all ApplyResourceChange (I assume this is per-resource?) calls are complete?

Discarding a logout error would still be a net improvement, but if it’s possible to do better, I’d like to do that.