close stdin/out/err before forking an instance