added proper file opening and closing in processor