Added error recovery if snd_pcm_writei fails

This prevents alsa reinitialisation in some cases, preventing a reset of the audio device.