[step_runner/subproc] Refactor handle closing out of main function.
[step_runner/subproc] Refactor handle closing out of main function.

R=a30c74fa30536fe7ea81ed6dec202e35e149e1fd@chromium.org

Bug: 910369
Change-Id: I3758a866514bc751352c97c37aad83d8c1d1d2b6
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1642343
Auto-Submit: Robbie Iannucci <40f3d43a28ebae3cb819288542e1c84d73d962d5@chromium.org>
Reviewed-by: Andrii Shyshkalov <a30c74fa30536fe7ea81ed6dec202e35e149e1fd@chromium.org>
Commit-Queue: Robbie Iannucci <40f3d43a28ebae3cb819288542e1c84d73d962d5@chromium.org>

luci/recipes-py,luci/recipes-py