change suggested by Matthieu to avoid crashing if the temp_directory has already been deleted by Runnable