Sorting keys in write_hdf5 prior to openening for-loop. Closed #39.