بسم الله الرحمن الرحيم
Q: What is the ruling on closing the eyes during the prayer?
A: Closing the eyes during the prayer is disliked, that is due to it being in opposition to what the prophet صلى الله عليه و سلم would do. An exception may be made in the presence of a legitimate reason, e.g. if there was excessive decoration and embellishment in front of the one praying on the wall or floor [perhaps creating difficulty in concentration], or there was a very bright light directly in front of him harming his eyes. The point therefore is, that if there is a legitimate reason to close the eyes then there is no harm, however without any such reason it is disliked, and further details on the topic can be sought from the great work of ibn ul-Qayyim “Zaad al-Ma’ad” [Provisions of the Hereafter]”
[Based on Shaikh ibn ul-Uthaymeen’s response to the issue, Fatawa Arkaan ul-Islam p341]