Stop SQL Server trace using SQL command

Today I started SQL Profiler and paused it. After some time, none of the buttons were enabled. I can neither resume nor stop the trace. Here are the sql commands that I finally found to stop the trace. 1) Get the trace id 2) Stop trace