The document keeps closing when I start writing on the Lex page