fix file-writer: add error listener