Veteran Hafeez draws curtains on Test career