<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close_all_right(self):

 """ Close all files opened to the right """

        num = self.get_stack_index()
        n = self.get_stack_count()
        for i in range(num, n-1):
            self.close_file(num+1)