Multithreading pool resource fix

Have changed order of lines in close() method just as it was done for OGraphDatabase