<!-- Describe the issue -->

When trying to sign a transaction in a encrypted wallet that is locked, version 0.16 would return the following error:

```"Please enter the wallet passphrase with walletpassphrase first."```

While doing exactly the same procedure against 0.17, the response is something like:

```json
"hex": "020000000183ac9cc1137c444f32356fb070ecba194c87a05e43674c06a55f5b1d0561eabc0000000000ffffffff0180626a94000000001600141875aa6ab19c2551c11759cf3e9f4dd7aa40bcf500000000",
       "complete": false,
       "errors": [
         {
           "txid": "bcea61051d5b5fa5064c67435ea0874c19baec70b06f35324f447c13c19cac83",
           "vout": 0,
           "witness": [
           ],
           "scriptSig": "",
           "sequence": 4294967295,
           "error": "Unable to sign input, invalid stack size (possibly missing key)"
         }
     ]

```

<!--- What behavior did you expect? -->

v0.17 should check if the wallet is locked before trying to sign the tx and return the same error as v0.16 for consistency reasons.
"  \"details\" : [\n"
            "    {\n"
            "      \"address\" : \"address\",          (string) The bitcoin address involved in the transaction\n"
            "      \"category\" : \"send|receive\",    (string) The category, either 'send' or 'receive'\n"
            "      \"amount\" : x.xxx,                 (numeric) The amount in " + CURRENCY_UNIT + "\n"
            "      \"label\" : \"label\",              (string) A comment for the address/transaction, if any\n"
            "      \"vout\" : n,                       (numeric) the vout value\n"
            "      \"fee\": x.xxx,                     (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
            "                                           'send' category of transactions.\n"
            "      \"abandoned\": xxx                  (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
            "                                           'send' category of transactions.\n"
            "    }\n"
            "    ,...\n"
            "  ],\n"
            "  \"hex\" : \"data\"         (string) Raw data for transaction\n"
            "}\n"
            "\nExamples:\n"
            + HelpExampleCli("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
            + HelpExampleCli("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true")
            + HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
        );
    
    
    pwallet->BlockUntilSyncedToCurrentChain();
    LOCK2(cs_main, pwallet->cs_wallet);
    uint256 hash;
    hash.SetHex(request.params[0].get_str());
    isminefilter filter = ISMINE_SPENDABLE;
    if(!request.params[1].isNull())
        if(request.params[1].get_bool())