used 'with' keyword to open file properly