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 #1281 from jburel/viewer-issue-dev_4_4

Viewer issue dev 4 4