The threat of blackouts as more coal-fired power stations shut has been downgraded after a record year of investment in renewables and storage.