Wrap model+relic saving in a transaction

Additionally, added a missing relic creation statement in the catch-all else block at the bottom of the main worker function. This wasn't a big problem because that code path is never executed.