GridFS: Minor refactoring

 - Change return type of `gridfile_get_oid` for convenience
 - Add const qualifiers
 - Refactor `gridfs_init` and `gridfs_destroy`
 - Minor formatting changes