Release thread lock on exceptions