Added missing f:close()