Close stream in finally block.
Clean code and remove whitespace.
Dispose of the window when closing it.
Remove sun dependencies.
Modify method to create buffered image.
Review and clean.
Do not keep reference to images when closing.
Add code and review discard methods.
Merge pull request #1272 from jburel/viewer-issue

Viewer issue