         return after false
 
       collection.find(params).toArray (error, results) =>
-        console.log 'Error with fetching document by id: ' + error if error
+        if error
+          console.log 'Error with fetching document by id: ' + error
+
+          @close()
+          return after false
 
         @close() if @_closeAfterRequest
         after if results and results.length is 1 then results[0] else false

      cursor.skip  options.skip  if options.skip

      cursor.toArray (error, results) =>
        console.log 'Error with fetching documents: ' + error if error

        @close() if @_closeAfterRequest
        after results


    @getInstance table, (db, collection) =>
      collection.count params, (error, results) =>
        if error
          console.log 'Error with fetching counts: ' + error

          @close()
          after false

        @close() if @_closeAfterRequest
        after parseInt results, 10
