implemented the function to logout.