paper near end detection