Fixes slave deadlock problem.

 o Instances now only block access if they were already in a state
   where they allowed access in the first place. This way instances
   won't grab multiple locks on the database, which previously lead
   to the database blocking forever (locked several times, only opened
   once).
 o Refactored out quorum check into a utilty method and replaced incorrect
   majority checks in HighAvailabilityMemberStateMachine and MultiPaxosContext.