Add Refcount store

This PR adds refcount to the store and fixes broken snapshot/restore tests and testRandomDirectoryIOExceptions test that started failing as a result