Add a close() method so that it can be called at any time instead of
when the onClick method is finished