It will be a good idea to make sure that publish_dir exists in this step as well before assuming that the publish was already committed, in case tmp_dir does not exist because of any other errors.