Once you have finished writing information into a file, you should so indicate by sending a close message to the stream:
close
outputStream close.