Arrangements for cooling or ventilating by gaseous cooling medium flowing in closed circuit, a part of which is external to the machine casing