Fix NPE on saving without a file loaded