Fix writing of FileRegion in NIO transport