Australian Renewable Energy Agency handed lifeline after threat of closure