Australia narrowly defeat Wales for third place