Fix a bug and unit tests for Nth-value window function

The currentPosition should be incremented in all cases.