ensure unlock in case of exception