Stop polling if window or app loses focus, use locking mechanism to prevent multiple loads