Buoyed by housing recovery, Realogy turns a profit