Adding flushing for new file outputs
Fixing bundlelines line replacement bug
Adding flush