Is the actual power turning off? Or is it the display turning off? My iMac has that exact problem where the display will turn off.
open