When the premises mentioned in such certificate are not redeemed in pursuance of law, and the court issuing the underlying judgment has entered an order confirming the sale in accordance with Section 12-144.5, the legal holder of the certificate is entitled to a deed therefor at any time within 5 years from the expiration of the time of redemption. The deed shall be executed by the sheriff or other officer who made the sale, or by his or her successor in office, or by some person specially appointed by the court for the purpose. If the deed is not taken within the time limited by Part 1 of Article XII of this Act, the certificate of purchase is void unless the purchaser under the certificate of sale has gone into possession of the premises under and in reliance on the certificate of sale within the 5 year period. If, however, the deed is wrongfully withheld by the officer whose duty it is to execute it, or if the execution of the deed is restrained by injunction or order of a court, the time during which the deed is so withheld or the execution thereof restrained shall not be considered as any part of the 5 years within which the holder is required to take a deed.
735 ILCS 5/12-145