How to stop decrypting data after opening master key in SQL Server?
The command you're looking for is CLOSE MASTER KEY;

From docs.microsoft.com:


  This statement reverses the operation performed by OPEN MASTER KEY. CLOSE MASTER KEY only succeeds when the database master key was opened in the current session by using the OPEN MASTER KEY statement.