Locks modified

--> Removed the extra lock that is obtained after trylock succeeds.
--> unlock is called in a finally block.