Republicans make gains in Senate, but Democrats hold on to slim majority