There's two main problems
One is related to the book's intended audience, and how you manage the "MC vacuum" these deaths will cause.
First of all, market your book properly. You don't want reader's looking for a feel-good story. They aren't going to get what they want. Lots of people try to find what makes certain choices work and what makes them fail; a lot of the times, the difference lies in the audience. Whether a story that involves e.g. meaningless death is good or not depends heavily on the audience; some readers have deeply-rooted philosophies that would find meaningless death wrong and contrived; impossible and thus a cheat. Other readers find such stories to be affirming of their nihilism, for example. For some readers however, it doesn't matter whether it aligns with their beliefs or not; they just like the exploration of ideas and they can handle a few gut-punches. Others however, despite their philosophical inclinations, or lack thereof, are simply too saddened by such plots that their enjoyment is drowned out by their sadness.
These are all causes of failure that can't be avoided through how you write. They are avoided through how you market your book. Make it clear that this is a dark book.
The second problem is one that exists regardless of readership. A story needs an MC. I'll talk about how to avoid an MC vacuum in terms of this idea I call the "MC factor". The MC factor is pretty much the degree of which the MC(s) fulfill their essential role. The MC factor consists of three sub-factors.
MC factor = The conductivity of your MC(s)
X The number of MCs
X The compellingness of the MC(s)
I do realize that the first subfactor is itself a subfactor of the last, but that just means this one matters in two ways (it's squared).
The characters of a story is the reader's conduit; they bring the reader into the story's world, their personality being the reader's body and their worldview being the reader's eyes. The higher the depth and breadth of your characters' development, the more points of relation your reader can have with them. The more relatable they become, the more the reader is able to imagine themselves within the story, increasing the immersion, which is essential to a story. So, an MC's conductivity consists of how relatable they are, and that relatability is mediated by their development.
Now, you may be thinking: development can introduce traits that are unrelatable as well. Yes, and that contributes to an MC compellingness. A reader arguing with a character in their head, seeing the word from other perspectives, etc., can be quite exciting and compelling. An MC's likeableness also contributes to how compelling they are. The amount of conflict they cause in the story also contributes, and so on.
And then there's the number of MCs. I mean, imagine you've got one MC that single-handedly gives you a nice MC factor. Then, you introduce another MC with an equally good MC factor; then you've just doubled the MC factor.
So, what's my point here? Well, everything is relative. One book may have a far lower MC factor than another, yet still do better because of other things. Upping your MC factor is of course always a good thing, but when it comes to MC factor, the worry for competent writers isn't have one that's too low. No, the worry lies in having one that drops too much. In other words, a book with an MC factor of three is better than a book that starts with an MC factor of 6, that drops to a 3 (the numbers are random here, there is no way to quantify this, I'm just using them to clearly show the concept).
If an MC factor drops, you get an MC vacuum; the reader will feel deprived of their enjoyment and place in the story. Killing off an MC, if handled improperly, will cause a drop in the MC factor. Killing off a ton of MCs, even more so. How do you handle such a thing then? Well, you've got to increase, and set-up the increase, of the other factors. When you kill an MC, that's going to cause a change like The number of MCs
- 1. I am portraying this all very simplistically; here I'm assuimg all of the MCs are equal in all respects, which would then mean one could simply subtract one from the "number of" factor. That they're completely equal however, is unlikely. But bear with me, you can adjust it all to fit the facts that apply to the specific situation.
So, you've got to either add another MC to make up for the loss of one, or you've got to increase the conduciveness of your MC(s), or how compelling they are. You've go to do this at the right time as well. If you increase all of this a long time prior to killing off an MC, then you've just raised the MC factor, only to have it reduced again, giving more or less the same effect as if you had done nothing. If however, you introduce these increases very shortly before the death, and then you go full-force after the death, then you'll minimize the MC factor drop, having but a slight transition period of dipping down in MC factor and going up again.
The good thing is that a character death is always a good opportunity to develop characters, both due to the direct impact of the death on their development, and the indirect impacts, as the death is likely to cause events that then go on to increase development. So, I say, prepare for the death by upping these factors, and set-up future increases; then, when the deaths happen, milk them for all their worth. Make sure that this remaining MC reaches insane depths of character as a result of this.
So, to conclude, make sure you have an audience with the right stomach, and manage the MC vacuum your deaths will cause.