Added commented-out code for handling non-Windows terminal closing