fix bug when closing. that is to say login finished