Wayfair shares whipsaw as costs build up and loss widens