Handle NULL in win_format_event_string()
Fix error logging for WideCharToMultiByte()

Use GetLastError() when logging the error code.
Use temp file when updating evnetchannel bookmarks

Use temporary files and atomic move to update bookmarks when using
eventchannel. This method should be less error prone and easier to
understand.