Inverse freezing in mean-field models of fragile glasses