Registers a method to be run when the gui is closed. Arguments passed through to method:
the gui that is closed
the trigger
the method to run