moved semaphore lock outside of try catch, if it goes bang we don't want to release it