Gold futures end higher after four consecutive sessions of losses