close fd after curl or wget exits