bugfix: flush out file contents before reading them back

when creating repos, flush file contents to file before starting to read. i'm not certain on python internals in handling this, but this makes sure everything is in the file ready for reading first.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>