Don't leave the LSM tree locked on error.

References #1311