Fix traceback when pool is locked

Ticket:	#6591