Added session closing stuff