This fixes a Bad file descriptor error caused by attempting to access the

This fixes a Bad file descriptor error caused by attempting to access the request after it has already been closed.