Move the persisitence in a separate logout step

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>