Clean up the Dispose Method

This commit fixes a race condition in Dispose where we could be in the middle
of inserting an object while the Dispose executes
Prevent dispose guards from stopping the cache from flushing