From anomalies of finite symmetries to heterotic GUTs