Add a test to make sure if lock_for_update throws an exception, the lock...

... is removed.