Test session termination and do some cleanup.