Fixed PHP-853: MongoCollection::batchInsert() exceptions can obscure BSON encoding exceptions.

This also fixes a memory leak that the test case exposed.