Fix pool.end race conditions

fixes #915