Save the file only after running all the checks that occurs in the add_candidate

In case of conflict this avoid replacing the old file by the new one, conflicting. If something
goes wrong with the commit to the database, the file will be deleted.
Fix the unit-tests as the upload_path folder is created even if the file is later deleted