Stocks finish higher while foreign investors continue to flee market