[FIXED JENKINS-3539] Prevent empty file creation if left empty

I agree this is not a problem as long as it works for PR builder. Perhaps waiting for `project.getLastBuild() != null && !project.getLastBuild().isBuilding()` is a bit safer.