fix bug in pipeline; Now main process will also close the stdin to cut the association with the pipe