If db.beginTransaction() fails for any reason the lock will not be unlocked

If db.beginTransaction() fails for any reason the lock will not be unlocked.
I did not fix the indentation so you can see the changes properly.