Added mechanism to close loaded files.