Run applications only for the specified amount of time, then clean up if requested.