# Close a file after read/write

**URL:** https://discourse.nodered.org/t/close-a-file-after-read-write/18697
**Category:** General
**Created:** [2 December 2019 15:59 UTC](https://discourse.nodered.org/t/close-a-file-after-read-write/18697 "2019-12-02T15:59:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ksmeeks0001](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@ksmeeks0001](https://discourse.nodered.org/u/ksmeeks0001)
#### Post date: [2 December 2019 15:59 UTC](https://discourse.nodered.org/t/close-a-file-after-read-write/18697/1 "2019-12-02T15:59:32Z")

</div>

How would you set a file read/write to close the file after it is completed with it. I am adding to a CSV file at the end of each day but I would like the ability to edit the files manually if I wish. I receive the message that I can read the contents only.

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [2 December 2019 17:20 UTC](https://discourse.nodered.org/t/close-a-file-after-read-write/18697/2 "2019-12-02T17:20:38Z")

</div>

Not tested but the docs say that if you set the filename using msg.filename it will be closed after every write

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1b76fe96870527148a2ad538fc56d64c0fa84586.png)

so just put a change node before it and set msg.filename
