[SOLVED] On page close or open

I was wondering how to set an event listener for when the page closes

Does this help:

Yes. Thank you very much