One of the problems is that the variables Output and RepCheck are declared globally but then passed to the close function as (incorrectly specified) arguments. Change the declaration of Close to:
so that Close will use the global variables Output and RepCheck.
You've got several other syntax errors to fix as well. For example, in the Close function you have:
which presumably should be:
There's really no point to having this statement in Close():
This will work just as well if you remove the declaration of Open and change the while to:
There are others but I'll let you earn some of your paycheque