Cook Islands Prime Minister Mark Brown will retain his role after fighting off a no-confidence bid from the opposition.