The expression about skeletons in a closet comes from a fairy tale about Bluebeard the pirate, who, legend has it, murdered all his many wives.
When he gave his new wife the keys to the house, he forbade her to open a specific closet at the end of a long hall, which, of course, she did the moment he left on business.
When she unlocked the door and looked inside, she was horrified to find all the skeletons of Bluebeard’s previous wives.
We say people have “skeletons in their closets” when they hide their past.