Gates to leave boards of Microsoft, Berkshire Hathaway