check return values of spool functions

We now check the return values of

* begin_data_spool()
* begin_attribute_spool()

as otherwise the job hangs until eternety if there is a problem with the
spool file.

Fixes: #265: job hangs and cannot be terminated if spool file is not writable