Hurricane Matthew was nearing the Bahamas, regaining some of the strength it had lost after swiping Cuba and leaving a trail of destruction in Haiti.