Close windows when last plot layer is deleted

Closes #391
Merge pull request #414 from ChrisBeaumont/391

Close viewers when layers removed