Q. How long is one allowed to leave a sefer one is learning from open, when exiting a room?
A. Shach and Taz (Y.D. 277: 1) quote Bach and Yerushalmi Megila, that the one who stops learning and goes to another room, leaving an open sefer, will forget his learning. They quote Cabbala sources which teach, that an angel named Shed (the first letters of Shomer Dafim or the one watching over the Torah pages), will become empowered and make the one who so behaves forget the Torah he has learned. (See question 2520 regarding covering the sefer)
Horav Shlomo Miller’s Shlit’a opinion is that if one is planing to return promptly to his learning, as when only exiting for attending the facilities or bringing a drink, one does not have to close the sefer/
Rabbi A. Bartfeld as advised by Horav Shlomo Miller and Horav Aharon Miller Shlit’a