Fixed some minor SelectBox bugs.
Better canWrite, doesn't overwrite existing file.

#1301
#1388
Merge branch 'origin/master'
Fixed map iterator remove failing rarely.

closes #1390