cleanup dup, dup2, dup3 to be more like OS