Fix segfault on exit by not fclose()ing an invalid FILE*.
Release image allocated in MainWindow::MainWindow.
Merge pull request #1 from sanjoy/bugs

Bugfixes