[Enhancement] Adding close action & improving route deactivation logic

Adding a new action called "closeSocket" which will close the connection.

Improving the logic when a route deactivates. Previously the app would destroy the connection before the onclose method would fire. Now when a route deactivates the onclose action will fire properly. If you would still like your connection to stay open you can still set the `keepSocketAlive` on the route to true.