unit test for the task that throws from CloseEvent handler