Intraspecific niche flexibility facilitates species coexistence in a competitive community with a fluctuating environment