How to Close libreoffice spreadsheet after some time, automatically?

I have a spreadsheet that needs to be worked on by everyone in the team (Max. 30 people). Most of the time, people tend to leave the sheet open thereby making it on a read only mode.

If I could get a macro that would close the sheet if its inactive for more than 5 seconds it would be great (similar to timer function in excel).

Example vba for MS Excel is here.

How to implement the same in LibreOffice Spreadsheet?

Maybe could be a good option open the document in a share mode.
Use the help bottom to know more about share a document.

this is a very interesting feature of calc!