Fix method lock release upon exception

Method lock was not released if method execution was ended
with uncaught exception. As a result dead lock could occur.
This commit moves lock release code into finally block

Change-Id: Ie5794c55c9d5a30cd3255ac06e9af944eb732bb1
Closes-Bug: #1392102
(cherry picked from commit 5cc02804902b78a83d2ee3a5698f4807a13ebde6)
Merge "Fix method lock release upon exception" into stable/juno