Fix prepared dispose after connection close

NpgsqlCommand now listens to its connection's open/close events.
On close, sets its prepare status to NotPrepared, avoiding the
DEALLOCATE on Dispose().

A bit of additional cleanup around command/connection relations,
but further work is needed for cases where the same command gets
transferred across connections.

Fixes #393
Relates to #299