Fix fd leak