I think this is just a thing that happens in the movies. Also, check out the source document and let me know if you think someone found guilty of the described acts deserves immunity.
It's not really a matter of my opinion on the specific case. Even with the full documents, there is no way that I'd have enough information to judge fairly, so I wouldn't try to.
I'm just saying that they have a way out, and it seems that they've made the judgment that the potential of finding other criminals (if that's even a motivation) for them is not worth it. And the courts are making the downside "indefinite prison", which isn't much of a downside for the prosecutor.
I think you can expect this to be used far more broadly if this is allowed. If I were a prosecutor I'd probably abuse the power too as yet another lever to use to get my way.