setting finish event on outputstream