Decrement the reference count of the given resource. If the reference count reaches 0, the resource is destroyed.