TIMOB-12487: Check for activityStackSize when terminating the activity s...

...tack since calling finish() can potentially change the size of the activity stack.

https://jira.appcelerator.org/browse/TIMOB-12487

Test case in Jira.