output: fix bug, a closed file is not a nil file