Fix wrong out_dir and ensure JSON index file is read into memory
Use `Pathname#open` like `#generate` instead.
Call `#generate` first to make sure the JSON index file exists