A geometrically based criterion to avoid infimum gaps in optimal control