Isolate shutil.rmtree logic in tempfiles.try_delete, and integrate azakai's feedback