Pi Camera Error : for loop in python

intent : All I’m trying to do is find the average pixel as time progresses
observation 1: code runs without error when the range value is 1
observation 1: code errors out when the range value is 10. See error below:

ERROR
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x2610170 (ENOSPC)
mmal: mmal_connection_enable: output port couldn’t be enabled

Backend terminated or disconnected. Use ‘Stop/Restart’ to restart.[/color]

My Code:
myavg = []
mytime = []
for i in range(10):
camera = PiCamera()
camera.resolution = (640,480)
imageCapture = PiRGBArray(camera,size = (640,480))
camera.capture(imageCapture,format=“bgr”)
image = imageCapture.array
average_value = np.average(image)
myavg.append(average_value)
mytime.append(i)
time.sleep(0.5)

plt.plot(mytime,myavg,‘o’)
plt.title(“pixel average”)
plt.xlabel(“time”)
plt.ylabel(“average”)
plt.grid(True)
plt.show()

Any idea why this is happening?