added function to flush to disk and wait for completion
bumped version to 0.4.2