finish while loop