reference counting for user started capabilities

The idea is that if multiple apps use a capability then it should remain running until they are both done with it, at which time it should shut itself down.