Finish logout function