Wide flat minima and optimal generalization in classifying high-dimensional Gaussian mixtures