Break from while loop after some time