Ensure that write_gexf and write_graphml output XML declaration

#1143 complained about duplicate XML declarations, which was supposedly fixed by #1172. But now it seems that XML declarations are consistently missing. Hopefully this fixes it.