Move LimitedWriter and GapSlice to new util package