Furore over president’s comments comes just days before knife-edge US presidential election