SERVER-13202 wait for secondary to flush buffer before assuming primaryship
(cherry picked from commit 3792e501d812a51b796cc670aaf3e3b8c2439682)