charm: close file after opening