How to Write A True Story w/o Being Sued?

I’ve always wondered about those disclaimers like: “Any resemblance to actual people, places or situations is coincidental.” That’s probably to ward off lawsuits, I’ve always thought. But they often make reference to or even portray actual historical figures such as, say, Abraham Lincoln or FDR. So if it can be shown some of the characters are not fictional after all, does that leave the door open to claims about other figures?