adding rake. fixing exceptions thrown when app is forcefully shut down