The Nasdaq wrapped up its worst year since 2008 and is mired in a slump that’s drawing many comparisons to the dot-com crash more than two decades ago.