Generalized Ward identity and gauge invariance of the color-superconducting gap