fixing check on Membership  duplication checking that is not closed.
Closing old membership when creating a new one.