You don't provide the rest of the code so I have to guess that reader is a SqlDataReader class based on the structure of your code. If this is the case, you should refer to http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getbytes.aspx
] for proper usage of the GetBytes method.
But, assuming I'm correct, it looks like the problem is your understanding of the parameters. GetBytes will attempt to read the number of bytes specified in the bufferSize variable. In your first read, you read bufferSize number of bytes from the stream. Assuming there are, at least, bufferSize + 1 bytes in the stream, you will go into the internal read loop requesting bufferSize number of bytes. If there is less than bufferSize number of bytes left, you are attempting to read past the end of the buffer... which is why you are getting the error.
If you read the notes in that link, you will see that if you pass a null output buffer, you will get back the total number of bytes in the stream. You could probably make all of this a lot easier by calling:
retval = reader.GetBytes(1, 0, null, 0, 0);
retval = reader.GetBytes(1,0,outBytes,0,retval);
There really is no reason to break the read up into multiple passes unless it was a massive binary blob that would be too big for the heap to allocate the outBytes array. Instead, get the size of the stream, reallocate the output array, fill it with all the data in one pass, and write it out to disk.
And on a side note, you don't really want to open and close your file handle for each new row... You should move that logic to outside the while loop. It will greatly increase the performance of the loop.