Fixed "database locked" exception when transaction is rolling back

See added test to get more details