Make sure we output valid JSON

Currently, when recording requests it:

1. Seeks to the end of the file.
2. Check size of currently flushed file, this isn't necessarily correct as it may return 0

I've changed it to check the current seek position using ftell which fixes that.

There's also a test which fails on master for me and then passes with this PR.

Cheers for a great library btw! Really loving it.