If there are no error lights showing and it runs for a few hours first, it's possible that the unit is just running as normal, and switching itself off (going on standby) when the humidity level in your home has reached the optimum humidity level.
The other question is, when you say that it turns itself off, is the fan still running without producing heat? If so, this may indicate that the unit has just gone into standby mode (i.e. the humidity level has been reached and it stops running to save on energy).
Or does the entire unit switch off along with the lights? If so this may indicate a possible power fault and it would need to come back to us for repair.
For your information as well, the units will stop running when it has reached about 45 - 50% RH and/or if the temperature is too high.
For example, on "laundry saving" mode if the temperature is more than 35*C and the humidity level is between 55 to 60%RH, the unit will stop dehumidifying and go to standby mode. If the humidity rises again, it will start running again.
So if it's getting warmer where you are, or if your area is getting lower in humidity, the unit may just be operating normally and stopping operation due to these factors.
The best way to check if the dehumidifier is faulty is to run it in a bathroom (place it in a safe, dry area) after you've taken a shower, when the bathroom is clearly humid / wet. The tank should collect water and the bathroom should be dry when it stops running.