Free the data if necessary, fix disk leak. (Also close it)