That sounds like a problem with your case fans not removing hot air from the cabinet. If the problem was the CPU (or GPU) fan then you wouldn't expect whether the case was open or not to make a lot of difference. Are you sure you have the right combination of fans pulling air into the case and pushing it out. (There's no simple answer to what is the best combination as it very much depends upon how many fans you have, what components you have, and how they are arranged in your case. But you should have at least one inlet fan and one pushing air out. IMO you will ideally have positive pressure within the case to help expel the air, but ymmv. Googling the subject will provide a lot more info.)