json_writer makes sure to write last trial now
json_writer handles stim dsets with extra entries (Fixes #3)

 - json_writer now writes the last trial in the stream
 - the stimulus dataset is sorted so that the first stimulus is used