Closing streams and changing target mock path