Harlequins survived a late scare to beat Northampton 35-29 in a Gallagher Premiership game that featured nine tries.