implemented automatic logout on closing operation (must be called somewhere else, maybe onChange)