Rename flushAndWrite() to writeAndFlush()

- Related: #2066
Rename flushAndWrite() to writeAndFlush()

- Fixes: #2066
- Fixed inspection warnings