Always hold the LSM tree lock while writing the metadata.

refs #720