modified how to close session