Fixed lifecycle handling during slave switch. No longer causes deadlock with concurrent shutdown of database.
Added predicate to wait for all instances to be joined when using arbiters