If you leave your computer running but leave the screen, or go to another tab or window, after 5 minutes you'll see a popup prompting you to click a button to continue playing.

 You have been inactive for some time; press OK to continue playing.

This popup will affect the display of your trains, but doesn't appear to have any impact on actual operation. On your screen, the trains will stop moving at the nearest station (resuming when you click OK), but they'll keep running in the background, making money, delivering goods for ongoing competitions, etc.