dec refcount on refdb instead of always freeing
Merge pull request #1464 from ethomson/refdb_free

dec refcount on refdb instead of always freeing