Add Exception handling between DOI DB threaded transactions

Timeout errors on 11/20 were traced back to the DOI minter waiting for
a lock on the DOI.db file.  

Likely means a begin/end call wasn’t balanced.  It didn't look like any calls were missed, but it's possible an exception is being thrown before a transaction is ended, causing the lock to never be released.

This change adds exception handling and ensures that transactions are always finished.