further implemented main.py module

added imports
initial commit of shutdown.py

shutdown.py script cleans up before cleanly exiting runtime