Is it possible to know when the current project is closed?

Hi,

in a TM plugin is it possible to know when the current project is closed, and/or the plugin is not used? I want to close the connection to my provider when the plugin is not in use and the user is doing something else. How can I get information when this happens?

Thank you!

Agnes