Forgot to flush rollback pre-compiled statement during memory flush.
Minor optimization: was setting the same variable twice
Fixing potential memory leak
Performance optimization: no need to mark the sql-level shared read-lock from a read-write transaction