references: add Is_Last primitive

It's almost a break in abstraction, and it's unsafe to use when the
reference can be accessed concurrently. However it might have some use
in some context, to free the last reference when checked in a protected
or thread-local context, to build a crude garbage collection system.