Added a check if we're at the last packet, which means we don't need to wait for a read timeout

Signed-off-by: Lilis Iskandar <veeableful@gmail.com>