Tropical Storm Ernesto is battering the northeast Caribbean as it takes aim at Puerto Rico, where officials have shuttered schools and government agencies.