A system is a collection of matter within defined boundaries. The boundaries may be flexible. There are two types of system: closed system and open system.
In closed systems, nothing leaves the system boundaries. As an example, consider the fluid in the cylinder of a reciprocating engine during the expansion stroke. The system boundaries are the cylinder walls and the piston crown. Notice that the boundaries move as the piston moves.
In open systems there is a mass transfer across the system's boundaries; for instance the steam flow through a steam turbine at any instant may be defined as an open system with fixed boundaries.