On Takens' Last Problem: tangencies and time averages near heteroclinic networks