CXX-242 Backport server 2.7.1 to driver legacy branch
CXX-243 Refactor batching loop in writers

The existing loop, while correct, introduced a lot of state variables and iterator
manipulation. Some compilers were unable to prove initialization of all state
variables on all paths.

Refactoring to use a double loop and two tracking iterators removes the need
for the extra state and iterator manipulation and elminiates the warnings.
CXX-241 Add optimized builds to travis