Closing a file would be nice...
Make length calculation in pack object a function

There was a simple, yet ugly error in the pack file length
calculation. Now we can test the function by itself.

fixes #1