Why does the TV close after a few hours?
There is setting on Fire TV devices that will sleep the device after 4 hours of inactivity.
The setting can be found at...
Home => Settings => Preferences => Data Usage Monitoring => Disable "Still Watching"
This setting exists starting on Fire OS 6. If your device is running Fire OS 5, you will not need to change any settings.