Sandy pounds Bahamas after killing 40 in Caribbean