Fix very bad bug in tempdir deletion.
Fix very bad bug in tempdir deletion.

materialsproject/custodian,xhqu1981/custodian,specter119/custodian,alberthxf/custodian,specter119/custodian,davidwaroquiers/custodian,materialsproject/custodian,materialsproject/custodian,specter119/custodian