Ray of Command's effect ends during the cleanup step. So at this time the licid goes back to player A's control. The licid is still an aura, and still enchanting the same creature, and still has the "You control enchanted creature." text, so the enchanted creature is controlled by the licid's controller (which is now player A). However, since player B was the one who activated the licid's ability, it is player B only who can pay

to end the effect.