We want to avoid doing work when the context is shutting down, so give ourselves a function to check.