To prevent a leak, the stream should be closed before exiting.
Removing unneeded annotation and imports.