Fixed error that prevented save&close from working sometimes
Fixed js console error