KDE restoring the same old session on each login

Hello,
I have a problem with KDE 3 on OS 11.

I have two programs starting automatically when I login: terminal window and firefox. It might be some old session when I did not close this programs before logging out. Furthermore, it might have started after I incorrectly ended a KDE 4 session, but I can not be sure.

My question is: where is the file which KDE 3 and 4 use to save/restore programs not closed in current session?

Thank you for your answers and I very appreciate your help.
SDA