Harvard University says it will end its investments in fossil fuels, a move that activists — both on and off campus — have been pushing the university to make for years.