Headspace measurement in canning