Use g_file_open_tmp() instead of hand-rolling it