Handle logout, init database