Adding function that checks if previous page had open menu to menu load function