As mentioned previously it's actually ok to post your application on the day your visa expires, so 5 days early is more than fine.

Have you any idea what the waiting time is at the test centres near you? I know you have to wait a minimum of 7 days between booking and taking the test, but when I was booking my wife's test a couple of years ago most of the test centres I phoned up couldn't fit my wife in for at least a month.