Ensuring caches are only cleared once the graph is idle and shut down.