I run a py file and after sone hours it closed
That's by design, as our consoles are not meant for long running jobs. If you need one, consider using an Always-on task.