Fixes #15556. If the temporary directory is not removed, it will be retained in RPATH, which is a serious security concern.