While the 2004 Popular Vote was not extremely close, with Bush winning by about 3%, the Electoral vote was in a sense very close. Kerry lost Ohio by about 90,000 votes and if he had won Ohio, he would have been elected President. Many experts believe that Bush carried Ohio because there was a Constitional Amendment initiative on the Ohio ballot to ban gay marriage and that this probably increased turnout among religious conservatives. However, while said ballot initiative probably did increase the Republican vote, whether or not it increased it by 90,00 or so above what it would otherwise would have been seems questionable.
What more likely cost Kerry the Presidency is that after he received the Democratic nomination, he went on vacation, to rest and to plan for the fall campaign. However, during this time a group backing Bush, but totally independent of the Bush campaign, spent a lot of money on televison ads which strongly implied that Kerry had lied about his service during the Vietnam War, for which he had received medals. Political experts felt that the Senator failed to respond to these attacks early enough or forcefully enough, in order to refute them effectively. The Press developed a slang term saying that Kerry had been "swiftboated" by these television ads, which did feature some of the men that he had served with in Vietnam. Kerry later came back with some other men that he served with, to back up his version of his Vietnam service. Unfortunately, the damage had already been done.
Kerry is married to Theresa Heinz Kerry, the widow of former Pennsylvannia Senator John Heinz.