Numpy Array Memory Error When Shutting