check if a file is already open before trying to delete it
<p>How can I check if a file is already open before trying to delete it
programmatically?</p>

<p>something like this</p>

<pre><code>if (file is open){
    // close it first
}

// delete file
</code></pre>
