gui-thread-check: use fflush() after printf()

Using fflush() right away after printf() calls avoids the buffers to
be written in an apparently complete-out-of-sync way from the point
of view of the developer. This problem would specially occur when
redirecting all output to a file this way:

  mono Foo.exe > out.txt 2>&1

Without this fix, all the output from gui-thread-check would appear
at the end of the file, instead of in between the output generated by
the program.

Cherry-picked from https://github.com/slluis/gui-thread-check/commit/6988cd4cd2deb21d0a8006d63e1090996f18b92f