Added logic to handle new leader leaving mid election.