You Can't Simply Close Your Eyes or Avert Them.
Line of Sight is tricky. What it really means is Line of Effect. It matters not if you can or cannot see the creature, but rather if you have a direct line from your position to that creature, more specifically your eyes to the creature. But how do we come to this conclusion?
Spell targets require a clear path to the target, meaning you can't cast certain spells through glass, but other spells like Misty Step simply require you to designate a point that you can see, which is not a target. Frightened lacks the phrase "that you can see", so we can conclude that mere sight is not the source of the frightened condition. Rather, the effect of frightened is about the presence of the creature and line of effect to it. In order to block line of sight there must be an obstacle between you. This also means that simply not being able to see the creature isn't enough to negate the disadvantage. Indeed, not knowing where your fear is coming from can make you all the more frightened. Darkness and blindness will not protect you this way.
Simply closing your eyes also ignores similar rules for averting your eyes, which force you to look away for you whole turn, effectively blinding you towards that target until the start of your next turn. Remember, being blinded means you have disadvantage on attacks made against the creature and it has advantage on attacks against you. Your DM might rule that these rules are sufficient for the frightened condition, but there are no written rules that suggest you can close your eyes, action roll save, and then open them. Doing that would ignore line of sight rules.
Logically speaking, it makes no sense to put a clause about line of sight in the condition of Frightened if any character can close their eyes to remove line of sight.
You Can Duck Behind Total Cover
Total cover protects you from being the target of spells and attacks.
A target has total cover if it is completely concealed by an obstacle.
Therefore, if your DM rules that you have total cover, then that would block line of sight to the creature, ending your disadvantage on ability checks.