title: How can I close files that are left open after an error?
body: <p>I am using</p>
  
  <pre><code>fid = fopen('fgfg.txt');
  </code></pre>
  
  <p>to open a file. </p>
  
  <p>Sometimes an error occurs before I manage to close the file. I can't do anything with that file until I close Matlab.</p>
  
  <p>How can I close a file if an error occurs?</p>