This has been reported. The problem only occurs when you start the IDE, open a sketch, which opens another window, close the original window, and then close the second window and accept the 2nd window's offer to save the file for you.
If you leave the first window open (minimized is fine), the problem does not occur.
If I remember correctly, the problem is supposed to be fixed in version 18.