Hershey is to close a factory in Canada manufacturing products under its Brookside brand.