forcily flush out data in output stream to avoid socket closing exception
fix issue 137, add additional check to avoid exceptions at loading archived workloads