Thermoelasticity of open systems