Investment company Thoma Bravo is buying Medallia for $6.4 billion, or $34 per share. The deal is scheduled to close by the end of the year.