Use a transaction when creating an artifact.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
`Rollback` also does some internal bookkeeping, so you should always call it in case of an error.