Beijing hasn’t been able to stop foreign investors from fleeing China’s stock market