Codec error

The loader suffered 2 problems:

- CODEC error was thrown with a specific number of threads, as a result of parsing the input file to the end.
- the split up into multiple segments happened incorrectly, as boundaries were set incorrectly

Besides this, it now scales back the number of threads, in case the file contains not enough bytes anymore. It ensures the mid point estimate is larger than the start point, once there are only a few bytes left. No unnecessary threads are created with empty segments.
Yes, It is changed to returning a query buffer that contains all complete queries until it first passes the split point. The original version seemed to skip statements, in the conditions that the CODEC error occurred.