Don't call fseek unnecessarily.

This improves performance, especially on Windows.
Added an API for handling fatal errors