This commit refactors the following:
1. Cache 'this.chunkSize' and 'this.stream' when they are used frequently
2. Rename nextEmptyChunk()-->nextMissingChunk() to be consistent with getMissingChunks()
3. Use stream.loadedChunk[i] instead of stream.hasChunk(i), to be consistent
   across the file. Remove stream.hasChunk()
4. Simplify nextMissingChunk() by using one loop instead of two
5. Simplify getEndChunk()