puppeteer: How to automatically close browser when no activity detected

I am trying to make a single browser with automatically close when it does not have any action after three minutes, and the first challenge is about how to detect the browser is in using. And the second challenge is about how to set up a timer. I have some ideas about using the Debounce function with the event listener, but the most of function calls in puppeteer are async functions, so it gives me a lot of errors. So here is my question, what is the better to make this? Maybe an idea will help. Thank you.