Keeping programs from timing out and closing