Closes session on gui close.