There have always been people who have remained closeted due to the stigma in society surrounding the LGBTQ community. Particularly people in the public eye. Keeping up appearances and all that.
He will have known he was gay, it’s entirely possible his wife knew he was gay, but he didn’t feel comfortable making that information public.