Fix off-by-one event bug with sliding window emission