Fixed issue that prevented process from exiting.

Optimized database transaction.