TIMOB-14504 Fix argument wrangling in close and give proper arguments in _restart backport

Backport for 3.1.2 of #4482
Test is in Jira: https://jira.appcelerator.org/browse/TIMOB-14504#comment-263034