If you derive an sftp connection from an ssh connection you must close the sftp connection before closing the ssh connection if you use ssh2_dissconnect. In other words:
<?php
$ssh_con=ssh2_connect($sftp_server);
ssh2_auth_password($ssh_con, $sftp_user, $sftp_pass);
$scp_con=ssh2_sftp($ssh_con);
# do stuff with $scp_con
ssh2_disconnect($scp_con);
ssh2_disconnect($ssh_con);
?>