Trex Co. swings to profit in fiscal 2012