Save shard errors to database then write at end