Only txn_commit in read-write mode.

Don't txn_commit a DB on close if it was in read-only mode.
Make written value in WriteName const.

Make the vector<CNameIndex> value passed to WriteName const, as it
should be (since it won't be changed).
Merge pull request #73 from domob1812/readonly-db

Skip DB flush for read-only mode.