How to trigger close event for Rebol Console to execute some custom handler before one quit the console ?
Well, I don't understand why you need this. If you're running a script from the console, then surely your script "knows" when it is about to quit.
Maybe you're after a system shutdown or similar? In that case you need to look at the system ports.
See http://www.rebol.org/ml-display-thread.r?m=rmlNFFJ
for an example of trapping the shutdown event for different OSes.
AFAIK REBOL doesn't offer a hook for that. And if you wanted to do it with a system port hook, you would have to have an event loop running.
If you have behavior you want to trigger, the first thing I would do is add a simple SHUTDOWN mezzanine, to replace QUIT, and do your work there. You could view that as a feature or a limitation, meaning the user can avoid your logic by using the close button if they want.