close stdin as first attempt to terminate process cleanly.