Manipulation of localized excitons in CrPS4 by temperature and magnetic field