Don't silently return the current ledger

The "ledger" RPC handler expects the value specified in "ledger_index" to be either an integer or one of the strings "current", "validated" or "closed". Passing the requested ledger index as a string would cause the code to silently return the current ledger, resulting in confusion.

Clean up the code by returning appropriate error codes when unexpected data is encountered.