Cleanup transaction and locking management in runCount