BUG: fix some xdmf writer crashes

- Sets the number of output ports to 0, which avoid an error message in
  Paraview because the writer is used in a pipeline.
- Manages a potential null pointer, avoiding a crash which occurs when the
  user unchecks some blocks in Paraview for instance.

Change-Id: I09c69bc6ac715bcb4297df4e2a012514a7817c57