Ensure we throw an error if the user tries to write to a read-only file handle.