A free boundary problem related to thermal insulation: flat implies smooth