Improve and simplify the LSM switch logic

it is fine to keep writing into a chunk while it is being switched, until either it hits the hard chunk size limit or a switch transaction ID is chosen that is larger than the writer's.  Fixes an assertion failure introduced by #1432 that could write to an old chunk after the switch completed.

refs #1432, #1418
I think chunk can be NULL here - if there are no chunks to flush or evict.