Stock markets swung wildly on Friday, rallying at the close to cap off a turbulent week