US nut maker John B. Sanfilippo & Son has seen quarterly losses narrow despite a dip in sales.