added close/logout for restarts