TYRUS-318: Writer used to throw NPE when flush() was called twice.

- could also happen when flush() is followed by close()
- added JAXB roundtrip test (original report contained similar code)