Refactor Wlxml flush method

The flush method was doing operations that may fail in regards to
removing or creating elements in the document tree. This is bad because
it was happening after the report had a successful message added to it
for these actions.

This commit moves the actions to the appropriate places in the create and
destroy functions. It also refactors the flush function to avoid
processing properties at times they aren't needed. Overall readability
and understandability gain.