Hubble used Earth to calibrate the Wide Field and Planetary Camera 2. By pointing at Earth over time, a flat field image is generated which should have the same brightness across the frame. Using data from this frame, the sensitivity of Hubble images can be corrected. I assume Hubble does this now with Wide Field Camera 3, launched on the last servicing mission, but the
source is from 2000. Also, there's a relevant "
what-if".
As for the time Hubble takes its last image, it may be well before the spacecraft reenters the atmosphere. When Hubble falls deeper into the thermosphere, the thicker atmosphere prevents the spacecraft from accurately pointing its telescope. So, well before Hubble is a fireball, it won't be able to take normal observations, if any. The final image may just be a regular observation, as the spacecraft becomes too difficult to adequately control. A source for this information is difficult to find.
If scientists can figure out when Hubble cannot produce any more worthwhile data, they may prepare a stunning photo for its demise like for each of Hubble's anniversaries. This photo can be taken months or years in advance, so knowing exactly when Hubble cannot function properly is not vital.