src/io/sink_sndfile.c: improve error messages, set nsamples after write