Bug 1004313: Handle partial flushes correctly in nsBufferedOutputStream::WriteSegments. r=mcmanus