Two X-class solar flares occurred on 2017 September 6 from active region NOAA 12673: the first one is a confined X2.2 flare, and it is followed only $sim 3$ hours later by the second one, which is the strongest flare in solar cycle 24, reaching X9.3 class and accompanied with a coronal mass ejection. Why these two X-class flares occurred in the same position with similar magnetic configurations, but one is eruptive while the other is not? Here we track the coronal magnetic field evolution via nonlinear force-free field extrapolations from a time sequence of vector magnetograms with high cadence. A detailed analysis of the magnetic field shows that a magnetic flux rope (MFR) forms and grows gradually before the first flare, and shortly afterwards, the MFRs growth is significantly enhanced with a much faster rise in height, from far below the threshold of torus instability to above it, while the magnetic twist only increases mildly. Combining EUV observations and the magnetic field extrapolation, we found that overlying the MFR is a null-point magnetic topology, where recurrent brightening is seen after the first flare. We thus suggest a scenario to interpret the occurrence of the two flares. The first flare occurred since the MFR reached a high enough height to activate the null point, and its continuous expansion forces the null-point reconnection recurrently. Such reconnection weakens the overlying field, allowing the MFR to rise faster, which eventually crosses the threshold of torus instability and triggers the second, eruptive flare.