Yet another memory corruption fix.

Sessions keep own connection alive. So when connection erases last session from hash table, it may be destroyed together with the hash table in method 'erase'. It leads to memory corruption and segmentation faults. Now all such methods keep the object alive while executing.