[FIX] Handle pipe errors and dont write after child is killed