pass error to callback early in finishSinglePart

Access violations or non-existant buckets seem to only manifest in finishSinglePart().
This trivial PR checks for errors and passes them up to the callback, before trying to manipulate `data`, which in these cases is undefined.