Move JobStats creation inside job_from_file

Without this change, in case of errors in the XML files, a JobStats record would not be saved. As a consequence, the computation would not appear in the HTML report, by making it difficult to debug problems reported by the users. The tests are running here: https://ci.openquake.org/job/zdevel_oq-engine/813