Cristiano Ronaldo scored twice as Portugal ensured a top-place finish in their Nations League group after beating Poland 5-1 in Porto.