is there a way to effect a timeout to close a file

A file with sensitive data is password protected but this is no protection if the file is inadvertently left open. A macro or other method to provide a timeout so that if there is no activity on the file in a set time period then the file is closed.

I think there is not such option.

Usually the Operating System has an option to lock the user after a while, and if the computer it’s used by more than one user, then every one should access with their user not all with the same user.