A study of the thermodynamic irreversibility in a fluid expanding behind a moving piston