convert CBufferedFile into a RAII wrapper

- it takes over the passed file descriptor and calls fclose() in the
  destructor
- this fixes a leak in LoadExternalBlockFile(), where an exception could
  cause the file to not getting closed
ewww