Here is a more nuanced, data-oriented analysis which concludes that Walgreens probably left SF for normal corporate planning reasons: https://applieddivinitystudies.com/sf-crime-2/
> Overall, it doesn’t look like Walgreens’ 2021 closure rate requires explanation beyond pandemic effects, their own 2019 cost management program, and broader economic trends. Additionally, it appears their 2020 closure rate was below, or at best on par with, their 2019 closure rate, indicating that the new DA, who took office at the start of 2020, did not accelerate the decline of Walgreens in San Francisco.