Added save feature

Window now closes properly, added save feature which allows people to
save their generated plots.