Iraq border town freed from militants now isolated by war