Check return value of windows timer functions and handle errors