Add reference count to keys

When a key is created with the same string as another key, the existing key is
reused.  However, this means that a key.free() will free a key that may still
be in use.  This commit keeps a reference count for the number of times the key
was created and doesn't actually free it until the reference count goes to 0.

Additionally, a reference count 0xFF is used as a "never delete" flag to
prevent system keys (OVERFLOW, pinoccio, etc) from being deleted.