Only switch LSM chunks if all changes are globally visible

This fixes a long-standing deficiency in LSM with transactions, and is a step towards making LSM fully transaction safe.