Clean up termination handling and fix incorrectly passing test