Fixed crash caused by wrong chunkSize read

With wrong chunkSize written and read, there is a crash may raised in function gridfile_read_buffer() at line:
```c
  first_chunk = (int)((gfile->pos) / chunksize);  
```
when chunkSize is 0.

This commit fixed problem by:
1. avoid return 0 in gridfile_get_chunksize()
2. set gfile->chunkSize in gridfile_writer_init()