It bothers me that KDE IM Contacts logs you out when you close the main window, and there’s no GUI to change this behavior. The “fix” is simple, just edit ~/.kde/share/config/ktp-contactlistrc and change go_offline_when_closing value to false:
[General] go_offline_when_closing=false
Source: KDE Forums