Rio Olympics closes with spectacular ceremony