Add option for close button in the top-right corner (in the caption)

And also a few minor changes that JSLint build step complained about.