PSX loses 502 points, closes at 40,504.7 points