Online furniture retailer Wayfair has been working to restructure its business and has seen its losses narrow as it worked to aggressively cut costs.