gui: Use trap to make sure temporary files are removed.