Removed flushing data at the end to prevent blocking