Puts lock releasing in finally blocks