Handled application backgrounding. factored out NSTimer.