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.
The previous behavior was returning the complete statement closest to the split point. Is that incompatible with fixing this bug?