If the Quarry is close to finishing, or if you are in danger of stopping the Quarry, place a Builder on top of the Quarry and put Sand or Gravel in it. The Sand will be built and it will fall into the Quarry. The Quarry will mine the Sand or Gravel, which can be piped, through a filter, back to the Builder.