European champions Portugal beat Switzerland in Lisbon to finish top of European Qualifying Group B and reach the 2018 World Cup in Russia.