Fix issue with the same file being open twice.

If you have a file A open and then open a solution where file A is in
the user preferences, then file A will be opened twice.
Merge pull request #626 from lukaszunity/upstreaming/same-file-opened-twice

Fix issue with the same file being open twice.