Stop drawing when window is hidden/closed