added functionality for checking answers and closing popup window