Simplify memory accounting for LSM cursors, and free memory on close.