Release semaphore if client call throws and exception

Closes #4153