Only txn_commit in read-write mode.

Don't txn_commit a DB on close if it was in read-only mode.
Merge pull request #35 from domob1812/readonly-db

Only txn_commit in read-write mode.