I wrote a simple servlet as follows:
public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response)
If it's not you that's opening the stream, you should not close it.
The stream is opened by the container so the responsibility for closing lies with it.