You need to be more clear. 1) A file might be opened in the sense that there are handles of that file opened by one or more processes. 2) I don't know what you mean by "closed", is it that no process has opened the file currently? 3) A file has always been modified somewhere in the past, it might be a minute ago or a month ago or 10 years ago. That's how you create a file, you create it empty and then modify it. Do you mean that you want to get the date of last modification? What do you mean by "it is modified"?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal