A filled package is fed into the machine along a conveyor belt. The indexing star lifts the package and moves it to the lid application station. At the same time, the lid is removed from the container and placed under the closing station. The package is lifted up to the lid and then the package and lid are pressed together and against the hemming roll. At this moment, the package rotates and is connected by edging rollers mounted on a lever system in an airtight and reliable manner. Then the closed package is stopped, and the indexing star moves it back onto the output belt.