Fixed PHP-731: Memory leak during failover

The testcase for this is tests/replicaset-failover/mongocollection-insert-001.phpt