fixed query hang when query command failure occurred (added onCleanUp callback)