Rebels aligned with Islamic State are close to being defeated in the southern Philippine city of Marawi.