Major indices closed sharply higher on Friday as tech stocks bounced back following a wave of heavy selling in recent days.