Refactor the timer stopping logic into a single method