PayPal is closing the SF office because the new tax regime makes their business model nonfunctional (as it does to all payments businesses). The tax would be effectively based on payment volume, rather than profit, and so more than their entire margin would burn up in taxes.
Separately, PayPal is laying off staff across their other offices to cut expenses and transition further from a growth-of-revenues model to a model of stable revenue at lower cost. Now being not the time to try to have rapid growth in the space if you're already the entrenched player, at least according to them.