adding error handling on createWriteStream for better debug info