Kane Williamson hit an unbeaten 104 to help New Zealand over the line