Trap for case where no group or dataset id when getting file name
Proper implementation of primary/secondary locators

Now all locators are registered in a hash indexed by file_id.
datAnnul frees the current locator but also triggers a scan
of the array of locators associated with that file and does
a reference count. If there are no longer any primary locators
all the locators are annuled and the file is closed.

datRefct now works properly and datPrmry will now trigger
this flush if the last primary locator is turned into a
secondary locator.

Note that this will cause SEGVs later on if people then use
one of those secondary locators. HDSv4 separated locator struct
from internal representation and would not free the user
memory. We may have to do a partial annulment and retain the
empty struct.