you really only need to "remember" the contig of the last read. This is only useful if the window crosses the end of contig barrier. If it does so, I think that the best thing to do is to return the "incomplete" window with the end of the contig, and start a fresh one on the next contig in the next iteration.