Moved execution of onFlush handler to onFlush command in connection.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>