I admit to a bit of conjecture here as there really is no way to fully know the thoughts or true reasons of a person comitting suicide, as they may have ulterior motives in the act itself.
Psychologically speaking, these men knew it was morally wrong and abhorrent to be destroying entire groups of "undesirables," and knew that the rest of the world would find it to be so. The Nazis did not start out with the Final Solution, at first they rounded up Jews and other undesirable people, but then did not come up with a plan about what to do with them until after they had already seized them and sent them to ghettos. Plans for possible expulsion from German territory was floated around at first, then mass sterilization was put forth, and finally, as the war progressed, it was decided that eradication was a simpler and more foolproof way to not have to deal with these people again. The concentration camps themselves served three purposes, first was slave labor (though never actually acknowledged as such by the regime as it was seen as prison labor by them) second was the elimination of political enemies, and third was extermination of inferior races. The actions of Goering telling the SS to keep their "glory" to themselves shows that there was some inkling present in his mind that the morality, or at least the perception of, their actions could be bad.
Furthermore, committing suicide instead of standing trial could also be seen as a last act of defiance by a person solidly convinced they are in the right but feel they will be judged unfairly by people who do not share their values. Why give your enemies the satisfaction of judging you, or killing you? Hate and hopelessness could both be seen as equal motivations for the suicides.
Suggested reading:
The Drowned and the Saved Primo Levi
The Psychology of Perpetrators and Bystanders Ervin Staub
Psychological Perspectives on the Perpetrators of the Holocaust Thomas Blass
For an insight into the average German mindset, there was a set of interviews conducted with one of Goebel's secretaries at the end of her life at age 105 that is very telling about the general population's attitude and beliefs toward the Nazis and the Holocaust as it was happening.