Common medications may leave lasting changes in gut bacteria years after people stop taking them, a study of more than 2,500 people found.