Fixed bug that kept application running on background after being closed