Expicitly closing file only in case of actual filesystem file