extl_serialise: write new data to temporary file and move atomically

Currently, extl_serialise will write directly to the file given as an
argument. If notion dies while writing or the serialisation fails for
other reasons it leaves an invalid serialisation file in place. This
can happen, for example, if the machine shut down races the shut down of
notion. With this change the new data is written to a temporary file and
moved atomically to the final location.