Fixed sending extra packets after end of file