handle end of stream correctly.

 closes #27 

fixes the issue for id4, ogg