I experienced the same problem when I had a window and a dialog box opened at the same in the AppBuilder (9.1D03). When saving the window all code was mixed up. I don't know if this is a documented bug.
Anyway, I never open more than one window or dialogbox at the same time in the Appbuilder.