Implementing ref counting for FileHandle