Close file to prevent leaking fd