Do not overfill the jars. Leave 2 cm or so of space at the top of the jar, though most recipes will actually specify the recommended headroom. If you run out of food before a jar is completely filled, it's OK to just leave it that way and seal it.