Added fileoutputstream to finally block.