# Does program interruption close open files automatically?

**URL:** https://discourse.julialang.org/t/does-program-interruption-close-open-files-automatically/79774
**Category:** General Usage
**Tags:** filesystem, file
**Created:** [April 21, 2022, 11:38am UTC](https://discourse.julialang.org/t/does-program-interruption-close-open-files-automatically/79774 "2022-04-21T11:38:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [April 21, 2022, 11:38am UTC](https://discourse.julialang.org/t/does-program-interruption-close-open-files-automatically/79774/1 "2022-04-21T11:38:38Z")

</div>

[This post](https://discourse.julialang.org/t/open-a-file-and-never-close-it/19091) talks about not closing a file on purpose.

What about unintentionally exiting the program? Will my files be blocked (I’m on Windows)?

I seem to remember having some problems with MATLAB years ago, and I had to close the whole program to liberate their handles.

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [May 18, 2022, 9:47am UTC](https://discourse.julialang.org/t/does-program-interruption-close-open-files-automatically/79774/2 "2022-05-18T09:47:16Z")

</div>

Yes, but, I believe all file handles will be closed by all modern operating systems (i.e. all Julia supports). You might have been using an outdated operating system.

So Julia wouldn’t need to do anything, but you might miss unflushed data, at least if on segfault. So it depends on what you mean by unintentionally. There was a recent thread about caching CTRL-C.
