Moved the code that closes an entry to a private js function, so that it can be reused.

When the user manually closes an entry, the function is invoked. It is also invoked when opening an entry, to close any other entries currently open (unless the user has selected the "open all entries by default" config option).
Corrected comment to accurately describe js method. Remove URL fragment manipulation when resetting entries, this is no longer necessary.
Added validation that the passed array contains entries, when setting all new entries as open.
If the user has selected the "open all entries by default" config option, entries are open (height: auto) as soon as they are open.

This had been broken by recent changes (switching from CSS transitions to JS animations when opening and closing entries).
After the entry opening animation has finished, set its height to 'auto'.

This way, if images in the entry are lazy-loaded after the animation has finished, the entry height will automatically grow to adapt to the newly loaded entry.

Previous to this entry height was fixed, which meant that if images finished loading after the animation finished, not all content would fit in the allocated viewport space.