Making sure, that hpx::finalize can be called from any locality

Making sure, that `hpx::finalize` can be called from any locality and that only the first invocation triggers the termination.

No API changes are caused, just fixes to the existing inconsistent behavior.