Wales concluded their Nations Championship campaign with a win against Japan, securing a positive finish to the tournament.