Everytime you buffer your output streams (BufferedOutputStream, BufferedWriter)
you should invoke flush to ensure that what you feed into the write method of the stream/writer is actually written for good.
Moreover, as a matter of good style and practice you should always invoke flush and close before getting rid of your stream object.
HIH