Adding a freeCommand() function to free commands.