US snacks maker John B. Sanfilippo & Son has seen its first-quarter losses narrow due to lower costs and rising sales.