stopping timer if window closed
optimized drawing