Break out of cursor.forEach by returning false

Fixes #1370