Obj: Ibevent alert problem

Using Interbase/Delphi4

I have a bug when I close my application. When the session is closed, a
thread of the EventAleter seems to be running so i have an error on Dbi
exit. If i close session  before IBevent the bug is on the destroy of
Ibevent alerter (cancel event) but the DbiExit is ok and it seems to be

How can I do to Have no bug...