end loop on EOF