Stop waiting threads in case of error