Fixed error with closing during poll