Heat wave pushes US grids toward blackouts as demand nears records