Added better error handling for truncated files when splitting