File operation error: emfile. when using temporary files

I am experiencing following error:

Target: /usr/lib/erlang/lib/et-1.6/ebin/Elixir.File.Error.beam. Function: get_file. Process: code_server.```
In my app I have multiple processes, one of them is downloading file from given URL and dumps each downloaded chunk into a separate file. I use following construct to dump chunk into a file: 
`!(path, [:binary, :write]) |> IO.binwrite(data) |> File.close`
And another process that reads these files with chunks uses `!`. I thought that both reading and writing should release file handles straight away, but based on the error I doubt that this is the case.
Is there some resource release option that I am missing?

Thank you.

Well it releases it by passing a message to the file server, so there is a slight delay (but not much), however on some OS’s (notably Windows) then the system itself can persist the lock longer than you’d expect.