[1.7.x] Fixed #22772 -- Defer wizard temporary files deletion.

Backport of e2112edd9a from master