If I had to guess, probably because most people stop drinking coffee after around 7 pm so that they can actually get to sleep at a reasonable time, and it is not economical for the shops to stay open beyond that time because of fewer customers.
https://www.numbeo.com/cost-of-living/compare_cities.jsp?cou...
25 to 50% cheaper to live in Portland. Implies coffee shop will have higher expenses to manage in San Fransisco.