Ensure onFlush and postFlush events are always called 

See #398 (has been closed as it wasn't against the master branch)