Write nodes in the cache to disk when clearing the cache