File Node signal error by overwrite file

Hi,

I have update my Node-RED from v0.18.7 to v.0.19.4.
Since this update, the file node sometimes signal an error when I would like to write data to a file (overwrite).

failed to write to file: Error: write after end

[{"id":"a22e61df.992bf8","type":"http request","z":"a1046e40.a79f38","name":"Wetterdaten speichern","method":"GET","ret":"txt","url":"","tls":"","x":650,"y":180,"wires":[["2a2e81a.4e29dfe"]]},{"id":"2a2e81a.4e29dfe","type":"function","z":"a1046e40.a79f38","name":"Dateieninformationen separieren und filtern","func":"var data = msg.payload.split(\"\\n\");\nvar result = [];\nvar re = /<a.*?>(.*?)<\\/a>[\\s]*(\\d{2})-(\\w*)-(\\d{4})\\s(\\d\\d):(\\d\\d)[\\s]*(\\d*)[\\s\\w\\d]*/;\n\nfor(i=0;i<data.length;i++){\n    var tmp = re.exec(data[i]);\n    if(tmp === undefined || tmp === null || !Array.isArray(tmp) || tmp.length != 8){\n        continue;\n    }\n    \n    var dwdStation = tmp[1].split(\"-\")[0];\n    var typ = tmp[1].split(\"-\")[1];\n    \n    /* Zeitstempel der Datei parsen */\n    var shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n    var month = shortMonths.indexOf(tmp[3])+1;\n    if(month < 10) month = \"0\"+month.toString();\n    \n    var offset = (new Date()).getTimezoneOffset();\n        offset = Math.abs(offset) / 60;\n        if(offset < 10) offset = \"+0\" + offset.toString()+\":00\";\n        else offset = \"+\" + offset.toString()+\":00\";\n\n    var ts = new Date(tmp[4]+\"-\"+month+\"-\"+tmp[2]+\"T\"+tmp[5]+\":\"+tmp[6]+\":00\"+offset.toString());\n    \n    /* neuen Dateinamen festlegen */\n    var fileName = ts.toISOString().substring(0,16).replace(\":\",\"\")+\"_\"+dwdStation+\"-\"+typ;\n    \n    for(var index in msg.dwdStations) { \n        if (msg.dwdStations.hasOwnProperty(index)) {\n            if(msg.dwdStations[index] == dwdStation){\n                result.push({\n                    path: tmp[1], \n                    saveFileName: fileName,\n                    ts: ts, \n                    size: parseInt(tmp[7]), \n                    dwdStation: dwdStation\n                });\n                break;\n            }\n        }\n    }\n \n}\n\nmsg.payload = result;\nreturn msg;","outputs":1,"noerr":0,"x":950,"y":180,"wires":[["3ef1716f.673d36"]]},{"id":"ec11f26b.4aa43","type":"file","z":"a1046e40.a79f38","name":"Wetterdaten speichern","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","x":870,"y":240,"wires":[["5161e1df.632868"]]},{"id":"b0f6da4d.f1b608","type":"http request","z":"a1046e40.a79f38","name":"download","method":"GET","ret":"txt","url":"","tls":"","x":660,"y":240,"wires":[["ec11f26b.4aa43"]]},{"id":"bd845c9f.6a3178","type":"inject","z":"a1046e40.a79f38","name":"start","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":"1","x":230,"y":180,"wires":[["3850b13e.f0222e"]]},{"id":"3850b13e.f0222e","type":"change","z":"a1046e40.a79f38","name":"Parameter festlegen","rules":[{"t":"set","p":"zielverzeichnis","pt":"msg","to":"D:\\temp","tot":"str"},{"t":"set","p":"dwdStations","pt":"msg","to":"{\"Erfurt\":10554,\"Meiningen\":10548,\"Gera\":10567}","tot":"json"},{"t":"set","p":"url","pt":"msg","to":"https://opendata.dwd.de/weather/weather_reports/poi/","tot":"str"},{"t":"set","p":"fileNameFilter","pt":"msg","to":"BEOB","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":180,"wires":[["a22e61df.992bf8"]]},{"id":"3ef1716f.673d36","type":"function","z":"a1046e40.a79f38","name":"Datenobjekte erzeugen","func":"var toLoad = [];\n\nfor(i = 0; i<msg.payload.length;i++){\n    var tmpMsg = Object.assign({}, msg);\n    tmpMsg.filename = msg.zielverzeichnis + msg.payload[i].saveFileName;\n    tmpMsg.url = msg.responseUrl + msg.payload[i].path;\n    toLoad.push(tmpMsg);\n}\n\nreturn [toLoad];","outputs":1,"noerr":0,"x":430,"y":240,"wires":[["52540842.a3abe8","b0f6da4d.f1b608"]]},{"id":"52540842.a3abe8","type":"debug","z":"a1046e40.a79f38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":650,"y":280,"wires":[]},{"id":"5161e1df.632868","type":"debug","z":"a1046e40.a79f38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1070,"y":240,"wires":[]}]

Is this an Error in the file node, or is my flow incorrect?

add a delay node in before the File node and change it to 'Rate limit' and give it a 3 second delay.

I think the node is attempting to write to the file a second time before the system has had time to close the file.

As an interim solution that sounds like a pretty good idea. But if the node internally continues to work faster than it has finished the previous process, that sounds like a software bug in the node.

Hopefully that is the same bug as that addressed by this PR ?

Thanks for the hint.

Has this been fixed in latest version?

I noticed this problem in ver 0.19.4

BR Walter