Only txn_commit in read-write mode.

Don't txn_commit a DB on close if it was in read-only mode.