A century partnership between Colin de Grandhomme and Tom Bruce helped New Zealand to a series-clinching four-wicket win over Sri Lanka.