System in which both matter and energy can be exchanged with the surroundings is