Added functionality for opening a file and for closing the application.