Add common close method, add some sleeps, fix event tests