If the error is a 'but-for' cause of death, then I think it ought to be counted. All treatments are aimed at addressing an underlying problem. Just because that problem is terminal doesn't change the fact that a mistake killed the patient. As someone who just watched up close a loved one die from cancer over a seven-year period, you really come to appreciate every minute that they're still breathing (with some allowance for the final, vegetative stages).